home *** CD-ROM | disk | FTP | other *** search
Text File | 1980-01-04 | 72.1 KB | 3,424 lines |
-
-
-
- * CROSSWORD.S - complete crossword designing/solving tool
-
- * Version : 1.20
-
- * Revision : 3.94
-
- * Details:
-
- * Program called either using the CLI command "crossword" or by
- * double-clicking upon WorkBench icon. Program takes no input
- * parameters. Access to disc files is via an extended disc access
- * requester (which will handle ALL disc functions required).
-
- * Requesters available for all manner of special application
- * functions, including clue editing and selection, solution
- * entry and removal, and grid manipulation (except those that
- * are handled via menu selection). Requesters have a standard
- * format.
-
- * NOTE : the graphical user interface is entirely my own devising,
- * and is intended to be both easy to understand and visually exci-
- * ting. A lot of effort has gone into this, so don't knock it!
-
- * Version 1.2 will have better gadget handling!
-
-
- include SOURCE2:INCLUDES/my_exec.i
- include SOURCE2:INCLUDES/my_dos.i
- include SOURCE2:INCLUDES/my_intuition.i
- include SOURCE2:INCLUDES/my_graf.i
-
-
- * Equates
-
- RawKeyConvert equ -48
-
- MEMF_VARS equ MEMF_PUBLIC+MEMF_CLEAR
-
- FALSE equ 0
- TRUE equ -1
-
- RastPort equ 50
- UserPort equ 86
-
- ON_MENU equ 8
-
- SQ_X equ 10
- SQ_Y equ 10
-
- MAXSQ_X equ 50 ;max no of allowed squares
- MAXSQ_Y equ 50 ;in grid in both directions
-
- MINSQ_X equ 3 ;min values of above
- MINSQ_Y equ 3
-
- GRID_BX equ SQ_X*MAXSQ_X+4
- GRID_BY equ SQ_Y*MAXSQ_Y+4
-
- GRID_LEFT equ 10
- GRID_UP equ 16
-
- MAX_DISPX equ 15
- MAX_DISPY equ 15
-
- MAX_DISP_PX equ MAX_DISPX*SQ_X+4
- MAX_DISP_PY equ MAX_DISPY*SQ_Y+4
-
- MAXCTLEN equ 20 ;max chars per line of clue
-
- HANG1 equ $10000 ;delay value 1
- HANG2 equ $8000 ;delay value 2
-
- DIRCOUNT equ 9 ;no of dir listing entries
-
-
- * main variable block declarations
-
-
- rsreset
-
- dos_base rs.l 1 ;library bases
- int_base rs.l 1
- graf_base rs.l 1
- consoledev rs.l 1
-
- ms_handle rs.l 1 ;screen handle
-
- mw_handle rs.l 1 ;main window handle
- mw_viewport rs.l 1 ;plus rastport etc
- mw_rastport rs.l 1
- mw_userport rs.l 1
-
- mw_IDCMP rs.l 1 ;main window IDCMP
-
- mw_bitmap rs.l 1 ;main window Bitmap ptr
- mw_bwidth rs.w 1 ;width in pixels
- mw_bheight rs.w 1 ;height in pixels
- mw_bplanes rs.w 1 ;no of bitplanes
-
- event_class rs.l 1 ;Intuition message
- menu_id rs.w 1 ;data
- shift_stat rs.w 1
- gadget_id rs.l 1
- mouse_xpos rs.w 1
- mouse_ypos rs.w 1
-
- gadget_list rs.l 1 ;ptr to current gadget list
-
- menu_strip rs.l 1 ;ptr to current menu strip
- menu_list rs.l 1 ;ptr to list for current menu
-
- ReqCount rs.w 1 ;no of active requesters
- ThisReq rs.l 1 ;ptr to active rhb
-
- mp_across rs.w 1 ;square pointed to by the
- mp_down rs.w 1 ;mouse pointer
- oldmpac rs.w 1 ;and old square values
- oldmpdn rs.w 1
-
- topaz_font rs.l 1 ;ptr to Font struct
-
- currsq rs.w 1 ;used for repeated square changing
-
- grid_bmap rs.l 1 ;ptr to grid BitMap structure
- grid_width rs.w 1 ;width in pixels
- grid_height rs.w 1 ;height in pixels
- grid_planes rs.w 1 ;no of bitplanes
-
- grid_rp rs.l 1 ;ptr to synthetic RastPort
- grid_tmpras rs.l 1 ;ptr to TmpRas for it
- grid_trbuf rs.l 1 ;ptr to buffer to use
-
- grid_array rs.l 1 ;ptr to "char" array (actually UWORD)
- undo_array rs.l 1 ;ptr to undo array (new for 1.2)
-
- grid_across rs.w 1 ;no of squares across
- grid_down rs.w 1 ;no of squares down
- grid_bytes rs.l 1 ;no of bytes in array
-
- grid_offset rs.l 1 ;offset to current square in array.
-
- grid_firstx rs.w 1 ;across sq addr, top left corner
- grid_firsty rs.w 1 ;down sq addr, top left corner
-
- grid_hl rs.w 1 ;upper and lower coord limits for
- grid_hu rs.w 1 ;crossword grid
- grid_vl rs.w 1
- grid_vu rs.w 1
-
- grid_hscrl rs.w 1 ;used to determine pot values
- grid_vscrl rs.w 1 ;for main screen PropGadgets
-
- clue_list rs.l 1 ;ptr to clue list
- clue_texts rs.l 1 ;ptr to clue texts
- clue_endptr rs.l 1 ;ptr to end of current texts
- clue_thisone rs.l 1 ;ptr to current clue text
- clue_editlen rs.w 1 ;length of current clue text
-
- clue_AcEntry rs.l 1 ;ptr to clue list entries
- clue_DnEntry rs.l 1 ;for marking solved clues
-
- pick_hpos rs.w 1 ;square position of
- pick_vpos rs.w 1 ;picked clue
-
- pick_offset rs.l 1 ;offset for picked clue
-
- pick_across rs.w 1 ;across clue no. picked
- pick_Ach rs.w 1 ;and its position
- pick_Acv rs.w 1
-
- pick_down rs.w 1 ;down clue no.
- pick_Dnh rs.w 1 ;and its position
- pick_Dnv rs.w 1
-
- solve_ptr rs.l 1 ;ptr to clue text for solve req
-
- soln_across rs.l 1 ;ptrs to various solution
- soln_down rs.l 1 ;texts
-
- savechar rs.w 1 ;in case char accidentally erased
- save_h rs.w 1 ;position of saved char
- save_v rs.w 1
-
- WSCount rs.w 1 ;no of white squares
-
- SLCount rs.w 1 ;no of solutions entered
-
- irt_itext rs.l 1 ;ptr to InfoReq ITexts
- irt_tlist rs.l 1 ;ptr to my text lists
- irt_count rs.w 1 ;no of texts to display
-
- erasecode rs.l 1 ;used by "Enter Solution" requester
- solvecode rs.l 1 ;as is this
-
- dp_window1 rs.l 1 ;used by Disc Panel code
- dp_rastport1 rs.l 1
- dp_window2 rs.l 1 ;for window reference
- dp_rastport2 rs.l 1
-
- dp_userport rs.l 1
-
- dp_window3 rs.l 1 ;for DiscInfoReq (actually a
- di_userport rs.l 1 ;window)
- di_rastport rs.l 1
-
- tmp_across rs.w 1 ;values used by SetAcross() &
- tmp_down rs.w 1 ;SetDown() etc.
-
- tmp_size rs.l 1 ;temporary saved new grid size
-
- dir_name rs.l 1 ;ptr to directory name for SortDir()
- dir_rename rs.l 1 ;ptr to buffer for Rename gadget
-
- dir_lock rs.l 1 ;lock for given dir
- dir_iblk rs.l 1 ;ptr to file info block
-
- dir_flist rs.l 1 ;ptr to files list
- dir_fcount rs.w 1 ;no of entries in files list
- dir_dlist rs.l 1 ;ptr to dirs list
- dir_dcount rs.w 1 ;no of entries in dir list
- dir_nodes rs.l 1 ;ptr to node space
- dir_strings rs.l 1 ;ptr to string space
-
- dir_nodepos rs.l 1 ;ptr to currently processed node
- dir_strpos rs.l 1 ;ptr to 1st new string area
-
- dir_error rs.w 1 ;error code returned by SortDir()
-
- dir_entnum rs.w 1 ;total entry count from SortDir()
- dir_entpos rs.w 1 ;1st entry accessed for dir listing
-
- file_buffer rs.l 1 ;ptr to file buffer
- file_size rs.l 1 ;size of file buffer
- file_acs rs.l 1 ;no of bytes in ACCL chunk
- file_dns rs.l 1 ;no of bytes in DNCL chunk
-
- file_shand rs.l 1 ;file handle for saving
- file_lhand rs.l 1 ;file handle for loading
-
- file_oldname rs.l 1 ;old name for rename/makedir/delete
- file_newname rs.l 1 ;new name for rename
-
- file_cwhd rs.l 1 ;ptr to CWHD chunk on load
- file_grid rs.l 1 ;ptr to GRID chunk on load
- file_accl rs.l 1
- file_dncl rs.l 1
-
- fmt_port rs.l 1 ;port created for disc formatting
- fmt_ioreq rs.l 1 ;IORequest created for disc formatting
- fmt_trbuf rs.l 1
- fmt_offset rs.l 1
- fmt_error rs.w 1
-
- disc_error rs.w 1 ;disc access error code. 0=OK.
-
- lib_unopened rs.w 1 ;unopened library code etc.
- error_code rs.w 1 ;DOS error code
-
- file_flags rs.w 1 ;File handling flags
-
- applic_flags rs.w 1 ;Application flags
-
- drv0 rs.b 1 ;flag byte for DF0 if it exists
- drv1 rs.b 1 ;flag byte for DF1 if it exists
- drv2 rs.b 1 ;flag byte for RAM if it exists
- drv3 rs.b 1 ;flag byte for DH if it exists
-
- editon rs.b 1 ;whether editing or not
- wantdir rs.b 1 ;want new dir after disc error Y/N
-
- vars_sizeof rs.w 0
-
-
- applic_flag1 equ applic_flags ;Q T 5 E P C RM LM
- applic_flag2 equ applic_flags+1 ;R E DP 4 3 HI H I
-
-
- * Flags:
-
- * Flag1:
-
- * Q : main application quit flag. 0 = quit.
-
- * T : crossword type flag. 0 = normal, 1 = Daily Express Small
- * Crossword (thick bars replace black squares).
-
- * E : Existence flag for clue list. 1=clue list exists,
- * 0 otherwise.
-
- * P : Picking flag. P=1 if picking a clue to edit or solve,
- * P=0 otherwise.
-
- * C : Change bit. C=1 if changing square values with mouse
- * pointer, C=0 if not.
-
- * RM : Right mouse button flag. 1=button held down.
- * Conditioned by MENUDOWN message from Intuition.
-
- * LM : Left mouse button flag. 1=button held down.
- * Conditioned by SELECTDOWN message from Intuition.
-
- * Flag2:
-
- * R : requester flag. 1 = requester active.
-
- * E : execute flag. 0=requester CANCEL pressed,
- * 1=requester SELECT/EXECUTE pressed.
-
- * DP : DiscPanel flag. 0=not in DiscPanel, 1=in DiscPanel.
-
- * HI : Hold Info flag. 1=keep InfoRequester on, 0=
- * exit InfoRequester at next button up message.
-
- * H : Help flag. 0=help OFF, 1=help ON.
-
- * I : inforequester flag. 0=inactive, 1=active.
-
-
- file_flag1 equ file_flags L S R D F M 1 0
- file_flag2 equ file_flags+1 F R 5 4 3 2 1 0
-
-
- * File handling flags
-
- * flag1:
-
- * L Load flag. 1=load function selected.
- * S Save flag. 1=save function selected.
- * D Delete flag. 1=delete function selected.
- * R Rename flag. 1=rename function selected.
- * F Format flag. 1=format function selected.
- * M MakeDir flag. 1=make dir function selected.
-
- * flag2:
-
- * F File selected flag. 1=filename chosen (hence Load, Save,
- * etc., have a valid filename to work with).
-
- * R Rename selected flag. 1=valid rename name exists in the
- * rename string gadget.
-
-
- * IORequest structure
-
-
- rsreset
- io_MsgNode rs.b mn_sizeof
- io_Device rs.l 1
- io_Unit rs.l 1
- io_Command rs.w 1
- io_Flags rs.b 1
- io_Error rs.b 1
- io_sizeof rs.w 0
-
-
- * IOEXTRequest structure
-
-
- rsreset
- ioext_Std rs.b io_sizeof
- ioext_Actual rs.l 1
- ioext_Length rs.l 1
- ioext_Data rs.l 1
- ioext_Offset rs.l 1
- ioext_sizeof rs.w 0
-
-
- * IOTD structure
-
-
- rsreset
- iotd_Std rs.b ioext_sizeof
- iotd_Count rs.l 1
- iotd_SecLabel rs.l 1
- iotd_sizeof rs.w 0
-
-
- * Event Handler Block definition
- * Pointers are :
- * 1) pointer to code for mouse handling in absence of MENUVERIFY
- * 2) pointer to code for event handling
- * 3) pointer to IDCMP list to use
-
-
- rsreset
-
- ehb_mousecode rs.l 1
- ehb_othercode rs.l 1
- ehb_IDCMPlist rs.l 1
-
- ehb_sizeof rs.w 0
-
-
- * Requester handling block structure
-
-
- rsreset
-
- rhb_Requester rs.l 1 ;ptr to requester to handle
- rhb_EHB rs.l 1 ;ptr to event handler block
- rhb_Window rs.l 1 ;ptr to Window Handle to use
- rhb_UserPort rs.l 1 ;ptr to UserPort of above window
- rhb_IDCMP rs.l 1 ;IDCMP for this window
- rhb_PreCode rs.l 1 ;Code to run before event handling
-
- rhb_sizeof rs.w 0
-
-
- * Clue List Entry data structure
-
-
- rsreset
-
- cle_Num rs.w 1 ;clue number
- cle_AcSq rs.w 1 ;Across square value
- cle_DnSq rs.w 1 ;Down square value
- cle_Text rs.l 1 ;Text:NULL if none present
- cle_Solved rs.b 1 ;0 if not solved:-1 otherwise
- cle_Filler rs.b 1
-
- cle_sizeof rs.w 0
-
-
- * Clue List Header data structure
-
-
- rsreset
-
- clh_AcList rs.l 1 ;ptr to Across List
- clh_AcCount rs.w 1 ;no of entries in this list
- clh_DnList rs.l 1 ;ptr to Down List
- clh_DnCount rs.w 1 ;no of entries in this list
-
- clh_sizeof rs.w 0
-
-
- * actual application program code. First step is to allocate space
- * for my variable block, referenced off A6.
-
-
- section Program,CODE
-
-
- main move.l #vars_sizeof,d0
- move.l #MEMF_VARS,d1
- CALLEXEC AllocMem
- tst.l d0
-
- beq cock_up_1
-
- move.l d0,a6
-
-
- * NOTE : a6 to point to my variables ALWAYS! ALL routines MUST leave
- * a6 intact from this point onwards!
-
-
- bsr InitVars
-
- bsr OpenAllLibs ;open all libraries needed
-
- move.w d1,lib_unopened(a6)
-
- tst.l d0
- beq cock_up_2 ;can't do it
-
-
- * Now open the TOPAZ80 font (which is ROM-resident). Because I'm forcing
- * use of TOPAZ80 I don't need the Diskfont Library since TOPAZ80 is a
- * ROM-resident font.
-
-
- lea Topaz_80(pc),a0 ;I want Topaz-80
-
- lea my_new_screen(pc),a1 ;this to be
- move.l a0,16(a1) ;sure of it
-
- CALLGRAF OpenFont
- move.l d0,topaz_font(a6) ;got it?
- beq cock_up_2a ;oops...
-
-
- * Here link Topaz font into all IntuiTexts that need it (such as the
- * InfoRequester/QueryRequester texts, & the gadgets where needed).
-
-
- bsr LinkFonts
-
-
- * Here create a custom BitMap. Don't forget to change size (here 320x256)
- * and planes (here 4) for other applications!
-
-
- move.w #320,d0
- move.w #256,d1
- moveq #4,d2
- move.w d0,mw_bwidth(a6)
- move.w d1,mw_bheight(a6)
- move.w d2,mw_bplanes(a6)
- bsr NewBitMap ;create my custom BitMap
- beq cock_up_3 ;can't do it
-
- move.l d0,mw_bitmap(a6)
-
- lea my_new_screen(pc),a0
- lea my_new_window(pc),a1
- move.l d0,a2
- bsr OpenSW ;open my screen & window
- tst.l d3
- beq cock_up_4 ;can't do it
-
- move.l a0,ms_handle(a6) ;screen handle
-
- move.l a1,mw_handle(a6) ;window handle
- move.l d0,mw_viewport(a6) ;it's viewport
- move.l d1,mw_rastport(a6) ;it's rastport
- move.l d2,mw_userport(a6) ;it's userport
-
-
- * Now set ColorMap
-
-
- move.l mw_viewport(a6),a0
- lea Palette(pc),a1
- ; moveq #16,d0
- moveq #32,d0
- CALLGRAF LoadRGB4
-
-
- * Now set drawing mode for main RastPort.
-
-
- move.l mw_rastport(a6),a1
- moveq #RP_JAM2,d0
- CALLGRAF SetDrMd
-
-
- * Now set the Font for the main RastPort.
-
-
- move.l mw_rastport(a6),a1
- move.l topaz_font(a6),a0
- CALLGRAF SetFont
-
-
- * Now pop in the "Zz" pointer
-
-
- bsr HangPointer
-
-
- * Now create BitMap for CrossWord grid.
-
-
- move.w #GRID_BX,d0 ;grid size
- move.w #GRID_BY,d1
- moveq #2,d2 ;& bitplane count
- move.w d0,grid_width(a6)
- move.w d1,grid_height(a6)
- move.w d2,grid_planes(a6)
- bsr NewBitMap
- move.l d0,grid_bmap(a6) ;got it?
- beq cock_up_5 ;exit if not
-
-
- * Now create crossword grid array. This is a WORD array, low byte of
- * each word = ASCII char in white square (SPACE if blank, ASCII NUL
- * if black square on normal grid), high byte = bar bits for type 2
- * crossword.
-
-
- move.l grid_bytes(a6),d0
- move.l #MEMF_VARS,d1
- CALLEXEC AllocMem
- move.l d0,grid_array(a6) ;got array?
- beq cock_up_6
-
- move.l grid_bytes(a6),d0
- move.l #MEMF_VARS,d1
- CALLEXEC AllocMem
- move.l d0,undo_array(a6) ;got array?
- beq cock_up_7
-
-
- * Now create a synthetic RastPort for the crossword grid.
-
-
- move.l grid_bmap(a6),a0 ;ptr to bitmap to use
- bsr MakeOwnRastPort
- move.l d0,grid_rp(a6)
- beq cock_up_8
-
-
- * Now create a TmpRas for the synthetic RastPort (VITAL!).
-
-
- move.l #tr_sizeof,d0
- move.l #MEMF_VARS,d1
- CALLEXEC AllocMem
- move.l d0,grid_tmpras(a6)
- beq cock_up_9
-
- move.w #320,d0
- move.w #256,d1
- CALLGRAF AllocRaster
- move.l d0,grid_trbuf(a6) ;area for TmpRas to use
- beq cock_up_10 ;and exit if can't get it
-
- move.l d0,a1
- move.l grid_tmpras(a6),a0
- move.l #320*256/8,d0
- CALLGRAF InitTmpRas ;set up the TmpRas
-
- move.l grid_tmpras(a6),a0 ;get TmpRas
- move.l grid_rp(a6),a1 ;and RastPort
- move.l a0,rp_TmpRas(a1) ;and link TmpRas to RastPort
-
-
- * Now set the Font for the synthetic RastPort.
-
-
- move.l grid_rp(a6),a1
- move.l topaz_font(a6),a0
- CALLGRAF SetFont
-
-
- * Now set drawing mode for synthetic RastPort.
-
-
- move.l grid_rp(a6),a1
- moveq #RP_JAM1,d0
- CALLGRAF SetDrMd
-
-
- * Now fill the RastPort with colour 1.
-
-
- move.l grid_rp(a6),a1
- moveq #1,d0
- CALLGRAF SetRast
-
-
- * Now initialise the static BitMap structures for the squares
- * used by the blitter.
-
-
- lea bsbmap(pc),a0
- moveq #2,d0
- moveq #16,d1
- moveq #10,d2
- CALLGRAF InitBitMap
-
- lea wsbmap(pc),a0
- moveq #2,d0
- moveq #16,d1
- moveq #10,d2
- CALLGRAF InitBitMap
-
- lea vbsbmap(pc),a0
- moveq #2,d0
- moveq #16,d1
- moveq #10,d2
- CALLGRAF InitBitMap
-
- lea hbsbmap(pc),a0
- moveq #2,d0
- moveq #16,d1
- moveq #10,d2
- CALLGRAF InitBitMap
-
- lea bbsbmap(pc),a0
- moveq #2,d0
- moveq #16,d1
- moveq #10,d2
- CALLGRAF InitBitMap
-
-
- * Now link the individual BitMap areas into the BitMap structures
-
-
- lea bsquare,a0 ;ptr to 1st image data
- move.l a0,d0 ;copy it
- lea sqtable(pc),a1 ;ptr to bitmap ptrs
-
- move.l (a1)+,a2 ;get ptr to BitMap
- move.l a0,bm_Planes(a2) ;link in image data
- addq.l #4,a2
- move.l d0,bm_Planes(a2)
- add.w #20,a0 ;point to next image
-
- move.l (a1)+,a2 ;get ptr to BitMap
- move.l a0,bm_Planes(a2) ;link in image data
- addq.l #4,a2
- move.l d0,bm_Planes(a2)
- add.w #20,a0 ;point to next image
-
- move.l (a1)+,a2 ;get ptr to BitMap
- move.l a0,bm_Planes(a2) ;link in image data
- addq.l #4,a2
- move.l d0,bm_Planes(a2)
- add.w #20,a0 ;point to next image
-
- move.l (a1)+,a2 ;get ptr to BitMap
- move.l a0,bm_Planes(a2) ;link in image data
- addq.l #4,a2
- move.l d0,bm_Planes(a2)
- add.w #20,a0 ;point to next image
-
- move.l (a1)+,a2 ;get ptr to BitMap
- move.l a0,bm_Planes(a2) ;link in image data
- addq.l #4,a2
- move.l d0,bm_Planes(a2)
- add.w #20,a0 ;point to next image
-
-
- * Initialise the grid with all black squares & display it
-
-
- bsr FillBlack2
-
-
- * Initialise the Undo Array (1.2)...
-
-
- bsr InitUndo
-
-
- * Here link in menu to main window if wanted. DO NOT FORGET TO
- * SET menu_list(a6) AND menu_strip(a6) VARIABLES BEFORE LINKING
- * IN THE MENU, OR ELSE DO_MENUS() WON'T WORK!
-
-
- move.l mw_handle(a6),a0
- lea my_main_menu(pc),a1
- move.l a1,menu_strip(a6)
- lea menulist_1(pc),a2
- move.l a2,menu_list(a6)
- CALLINT SetMenuStrip
-
-
- * Now pop in the MENUVERIFY! Actually doesn't because it's not
- * needed anymore, but I'll leave it in because it doesn't do
- * any harm...
-
-
- move.l mw_IDCMP(a6),d0
- move.l mw_handle(a6),a0
- CALLINT ModifyIDCMP
-
-
- * Here set up the screen PropGadgets ready...
-
-
- bsr SetMainHVPots
-
-
- * Now pop up my copyright message...
-
-
- lea IRT_1(pc),a0
- lea CopyRight(pc),a1
- moveq #8,d0
- move.l a0,irt_itext(a6)
- move.l a1,irt_tlist(a6)
- move.w d0,irt_count(a6)
-
- bsr LinkInfoText
-
- bsr ShowInfoReq
-
-
- * Ok, this is where we do a SetPointer() call and see if we've got our
- * flash pencil pointer...
-
-
- bsr MainPointer
-
-
- * Now we find out which drives are linked into the system. Because the
- * disc access panel isn't up, I can set the gadget flags directly & not
- * have to unlink/refresh etc. So the WhichDrives() routine does just
- * that.
-
-
- bsr WhichDrives
-
-
- * If DF0: is missing for some reason, pop up an InfoReq telling user
- * to get his Amiga mended.
-
-
- nop
-
-
- * Here handle Intuition Events
-
-
- main_1 move.l mw_userport(a6),a0
- lea ehb_std(pc),a5
-
- bsr DoEvent ;completely event driven!
-
- tst.b applic_flag1(a6) ;quit the program?
- bmi.s main_1 ;no (quicker than btst etc)
-
-
- * Once application no longer active, deallocate everything
- * in a hygenic fashion & return to CLI/WorkBench. Don't forget
- * to ClearMenuStrip() if SetMenuStrip() used above! Also, kill
- * off our custom pointer...
-
-
- main_2 bsr FreeText ;get rid of clue texts
-
- bsr DisposeClueList ;and clue list entries
-
- move.l mw_handle(a6),a0
- CALLINT ClearPointer
-
- move.l mw_handle(a6),a0
- CALLINT ClearMenuStrip
-
- cock_up_10 move.l grid_trbuf(a6),d0 ;free the TmpRas buffer
- beq.s cock_up_9
- move.l d0,a0
- move.w #320,d0
- move.w #256,d1
- CALLGRAF FreeRaster
-
- cock_up_9 move.l grid_tmpras(a6),d0 ;free the TmpRas
- beq.s cock_up_8
- move.l d0,a1
- move.l #tr_sizeof,d0
- CALLEXEC FreeMem
-
- cock_up_8 move.l grid_rp(a6),a0 ;free the synthetic
- bsr KillOwnRastPort ;RastPort
-
- cock_up_7 move.l undo_array(a6),d0 ;destroy undo
- beq.s cock_up_7 ;array
- move.l d0,a1
- move.l grid_bytes(a6),d0
- CALLEXEC FreeMem
-
- cock_up_6 move.l grid_array(a6),d0 ;destroy grid
- beq.s cock_up_5 ;word array
- move.l d0,a1
- move.l grid_bytes(a6),d0
- CALLEXEC FreeMem
-
- cock_up_5 move.l grid_bmap(a6),a0 ;free up grid BitMap
- move.w grid_width(a6),d0
- move.w grid_height(a6),d1
- move.w grid_planes(a6),d2
- bsr DisposeBitMap
-
- move.l ms_handle(a6),a0
- move.l mw_handle(a6),a1
-
- cock_up_4 bsr CloseSW ;close screen, window
-
- cock_up_3 move.w mw_bwidth(a6),d0
- move.w mw_bheight(a6),d1
- move.w mw_bplanes(a6),d2
- move.l mw_bitmap(a6),a0
- bsr DisposeBitMap ;get rid of main BitMap
-
- cock_up_2a move.l topaz_font(a6),d0 ;closing font?
- beq.s cock_up_2 ;nope
- move.l d0,a1
- CALLGRAF CloseFont ;else stop using it
-
- cock_up_2 bsr CloseAllLibs ;close all libraries
-
-
- * Don't forget to free the
- * variable block!
-
-
- move.l a6,a1
- move.l #vars_sizeof,d0
- CALLEXEC FreeMem
-
- cock_up_1 moveq #0,d0
- rts
-
-
- * InitVars(a6)
- * a6 = ptr to main program variables
- * initialise any special variables
-
- * MODIFIABLE
-
-
- InitVars moveq #15,d0 ;set up initial
- move.w d0,grid_across(a6) ;grid size.
- move.w d0,grid_down(a6)
- move.w d0,d1
- mulu d0,d1 ;no of WORDS in array
- add.l d1,d1
- move.l d1,grid_bytes(a6) ;size of grid in BYTES
-
- moveq #-1,d0 ;just in case the
- move.w d0,mp_across(a6) ;mouse pointer starts
- move.w d0,mp_down(a6) ;off the grid
- move.w d0,oldmpac(a6)
- move.w d0,oldmpdn(a6)
-
- moveq #1,d0
- move.w d0,grid_firstx(a6) ;TLC square #
- move.w d0,grid_firsty(a6) ;across & down
-
- move.l #idcmp1+idcmp2,d0
- add.l #idcmp3+idcmp4,d0 ;set up the
- ; add.l #MENUVERIFY,d0 ;default IDCMP
- move.l d0,mw_IDCMP(a6) ;for main window
-
- lea ReqBlock(pc),a0 ;set up the
- lea ehb_req(pc),a1 ;requester event
- moveq #0,d0 ;handling block
- move.l d0,rhb_Requester(a0) ;(static structure)
- move.l a1,rhb_EHB(a0)
- move.l d0,rhb_Window(a0)
- move.l d0,rhb_UserPort(a0)
- move.l d0,rhb_IDCMP(a0)
- move.l d0,rhb_PreCode(a0)
- move.l a0,ThisReq(a6) ;& save ptr to it
-
- lea IRT_1(pc),a0 ;ptr to InfoReq
- move.l a0,irt_itext(a6) ;IntuiTexts
- move.l d0,irt_tlist(a6) ;no TList
- move.w d0,irt_count(a6) ;entry count = 0
-
- move.w #GRID_LEFT,d0
- move.w d0,grid_hl(a6)
- move.w #SQ_X,d1
- mulu grid_across(a6),d1
- add.w d1,d0
- subq.w #1,d0
- move.w d0,grid_hu(a6)
-
- move.w #GRID_UP,d0
- move.w d0,grid_vl(a6)
- move.w #SQ_Y,d1
- mulu grid_down(a6),d1
- add.w d1,d0
- subq.w #1,d0
- move.w d0,grid_vu(a6)
-
- moveq #0,d0
-
- move.w d0,ReqCount(a6)
- move.w d0,applic_flags(a6)
-
- lea CLHeader(pc),a0 ;set up the
- move.l a0,clue_list(a6) ;clue list header
-
- move.l d0,clh_AcList(a0) ;and ensure that
- move.w d0,clh_AcCount(a0) ;no list data
- move.l d0,clh_DnList(a0) ;exists
- move.w d0,clh_DnCount(a0)
-
- move.l d0,clue_texts(a6) ;and no texts either
-
- lea AcrossBuf(pc),a0
- move.l a0,soln_across(a6)
- lea DownBuf(pc),a0
- move.l a0,soln_down(a6)
-
- bset #7,applic_flag1(a6) ;not quitting program!
-
- moveq #" ",d0
- move.w d0,savechar(a6)
- move.w d0,currsq(a6)
-
- rts
-
-
- * OpenAllLibs(a6) -> d0/d1
- * a6 = ptr to my main variable block
- * returns success/failure in d0 (success=TRUE)
- * if failed to open any library, returns
- * library code number in d1
-
- * a1 corrupt.
-
- * NON-MODIFIABLE.
-
- OpenAllLibs lea dos_name(pc),a1 ;DOS library
- moveq #0,d0
- CALLEXEC OpenLibrary ;get her address
- moveq #1,d1 ;code if not available
- move.l d0,dos_base(a6) ;is it?
- beq.s OAL_done ;bye-bye if not
-
- lea int_name(pc),a1 ;Intuition library
- moveq #0,d0
- CALLEXEC OpenLibrary ;get her address
- moveq #2,d1 ;code if not available
- move.l d0,int_base(a6) ;is it?
- beq.s OAL_done ;bye-bye if not
-
- lea graf_name(pc),a1 ;Graphics library
- moveq #0,d0
- CALLEXEC OpenLibrary ;get her address
- moveq #3,d1 ;code if not available
- move.l d0,graf_base(a6) ;is it?
- beq.s OAL_done ;bye-bye if not
-
- moveq #TRUE,d0 ;all's well!
- moveq #0,d1
-
- OAL_done rts
-
-
- * CloseAllLibs(a6)
- * Close all libraries opened by OpenAllLibs()
- * Only closes those that were opened!
-
- * d0/a1 corrupt
-
- * NON-MODIFIABLE.
-
-
- CloseAllLibs move.l graf_base(a6),d0 ;exists?
- beq.s CAL_2 ;no!
- move.l d0,a1
- CALLEXEC CloseLibrary ;else close it
-
- CAL_2 move.l int_base(a6),d0 ;exists?
- beq.s CAL_1 ;no!
- move.l d0,a1
- CALLEXEC CloseLibrary ;else close it
-
- CAL_1 move.l dos_base(a6),d0 ;exists?
- beq.s CAL_done ;no!
- move.l d0,a1
- CALLEXEC CloseLibrary ;else close it
-
- CAL_done rts
-
-
- * Workspace allocation defs for NewBitMap() etc
-
-
- nbm_width equ -2
- nbm_height equ -4
- nbm_depth equ -6
- nbm_pointer equ -10
- nbm_ssize equ -14
- nbm_space equ -18
-
-
- * NewBitMap(d0,d1,d2) -> d0
- * Allocate memory for, & initialise a BitMap
- * structure. Also allocate all of the Raster
- * bitplanes needed for it, & link them in.
- * d0 = width in pixels
- * d1 = height in pixels
- * d2 = depth in pixels
-
- * returns d0 = ptr to bitmap structure if allocated AND
- * all Raster bitplanes obtained, else NULL
-
- * d0-d2/d7/a0/a4 corrupt
-
- * NON-MODIFIABLE.
-
-
- NewBitMap link a5,#nbm_space ;reserve some workspace!
-
- move.w d0,nbm_width(a5)
- move.w d1,nbm_height(a5)
- move.w d2,nbm_depth(a5)
-
- moveq #bm_Planes,d0
- lsl.w #2,d2
- add.w d2,d0 ;size of BitMap structure
- ext.l d0
- move.l d0,nbm_ssize(a5) ;keep it!
-
- move.l #MEMF_PUBLIC,d1
- CALLEXEC AllocMem
- move.l d0,nbm_pointer(a5) ;save pointer
- beq NBM_done ;oops...
-
- move.l d0,a0
- move.w nbm_depth(a5),d0
- move.w nbm_width(a5),d1
- move.w nbm_height(a5),d2
- CALLGRAF InitBitMap ;init BitMap struct
-
- move.w nbm_depth(a5),d7 ;no of bitplanes
-
- move.l nbm_pointer(a5),a4
- lea bm_Planes(a4),a4 ;where Plane ptrs go
-
- NBM_l1 move.w nbm_width(a5),d0
- move.w nbm_height(a5),d1
- CALLGRAF AllocRaster ;get a Raster bitplane
- move.l d0,(a4)+ ;save pointer
- beq.s NBM_b1 ;cock up!
-
- subq.w #1,d7 ;done all bitplanes?
- bne.s NBM_l1 ;back if not
-
- move.l nbm_pointer(a5),d0 ;all's well-return ptr
- bra.s NBM_done
-
- * From here on, couldn't allocate a Raster bitplane. So deallocate
- * those that exist, then deallocate the BitMap structure & return
- * a zero pointer.
-
- NBM_b1 move.l nbm_pointer(a5),a0
- lea bm_Planes(a0),a0
- move.l a0,d7
-
- NBM_l2 move.l -(a4),a0 ;this one WAS allocated
- move.w nbm_width(a5),d0 ;size across
- move.w nbm_height(a5),d1 ;and down
- CALLEXEC FreeRaster ;get rid of it!
-
- cmp.l a4,d7 ;last one?
- bcc.s NBM_l2 ;no, go back
-
- move.l nbm_ssize(a5),d0
- move.l nbm_pointer(a5),a1 ;now free up the
- CALLEXEC FreeMem ;BitMap struct!
-
- moveq #0,d0 ;return NULL ptr
-
- NBM_done unlk a5
- rts
-
-
- * DisposeBitMap(a0,d0,d1,d2)
- * Get rid of allocated BitMap structure and its
- * associated Raster bitplanes.
- * a0 = ptr to BitMap to dispose of
- * d0 = width of planes to dispose of
- * d1 = height of planes to dispose of
- * d2 = no of planes to dispose of
-
- * d0/a0/a4 corrupt
-
- * NON-MODIFIABLE.
-
-
- DisposeBitMap link a5,#nbm_space
-
- move.w d0,nbm_width(a5)
- move.w d1,nbm_height(a5)
- move.w d2,nbm_depth(a5)
-
- move.l a0,d0 ;check if it exists
- beq.s DBM_done ;no it doesn't!
-
- move.l a0,nbm_pointer(a5) ;save BitMap ptr
- lea bm_Planes(a0),a4 ;ptr to Plane ptrs!
-
- move.w d2,d7 ;counter
- lsl.w #2,d2
- add.w #bm_Planes,d2
- ext.l d2
- move.l d2,nbm_ssize(a5) ;size of struct also
-
- DBM_l1 move.l (a4)+,d0 ;get plane pointer
- beq.s DBM_b1 ;doesn't exist
- move.l d0,a0
- move.w nbm_width(a5),d0
- move.w nbm_height(a5),d1
- CALLGRAF FreeRaster ;get rid of raster
-
- DBM_b1 subq.w #1,d7 ;done?
- bne.s DBM_l1 ;back if not
-
- move.l nbm_pointer(a5),a1
- move.l nbm_ssize(a5),d0
- CALLEXEC FreeMem ;get rid of BitMap
-
- DBM_done unlk a5
- rts
-
-
- * InitWindow(a0) -> d0-d2
- * a0 = pointer to Window structure
- * return parameters are:
- * d0 = ViewPort pointer
- * d1 = RastPort pointer
- * d2 = User Port pointer
-
- * NON-MODIFIABLE.
-
-
- InitWindow move.l a0,-(sp)
- CALLINT ViewPortAddress
- move.l (sp)+,a0
- move.l RastPort(a0),d1
- move.l UserPort(a0),d2
- rts
-
-
- * Workspace defs for OpenSW() etc
-
-
- sw_screen equ -4
- sw_window equ -8
- sw_bitmap equ -12
- sw_space equ -16
-
-
- * OpenSW(a0,a1,a2) -> d0-d3,a0,a1
- * Open Intuition screen and principal window
- * a0 = pointer to NewScreen structure
- * a1 = pointer to NewWindow structure
- * a2 = pointer to custom BitMap structure if present
- * NULL if not
-
- * returns:
- * a0 = pointer to Screen handle
- * a1 = pointer to Window handle
- * d0 = pointer to Window ViewPort
- * d1 = pointer to Window RastPort
- * d2 = pointer to Window User Port
- * d3 = success/failure
-
- * NON-MODIFIABLE.
-
-
- OpenSW link a5,#sw_space
-
- move.l a0,sw_screen(a5) ;save input
- move.l a1,sw_window(a5) ;parameters
- move.l a2,sw_bitmap(a5)
-
- move.l a2,d0 ;got a bitmap?
- beq.s OSW_2 ;no
-
- move.l d0,28(a0) ;set up bitmap ptr!
-
- OSW_2 CALLINT OpenScreen
- move.l d0,sw_screen(a5) ;save Screen handle
- beq.s OSW_1 ;ain't got one!
-
- move.l sw_bitmap(a5),d0 ;get bitmap ptr
-
- OSW_3 move.l sw_screen(a5),d1 ;get custom screen ptr
- move.l sw_window(a5),a0
- ; move.l d0,34(a0) ;set up BitMap
- move.l d1,30(a0) ;and screen ptr
- CALLINT OpenWindow
- move.l d0,sw_window(a5) ;save Window handle
- beq.s OSW_1 ;oops...
-
- move.l d0,a0
- bsr.s InitWindow ;get important
- moveq #TRUE,d3 ;parameters
- bra.s OSW_done ;& signal success
-
- OSW_1 moveq #FALSE,d3 ;signal failure
- move.l d3,d0 ;and clear all of
- move.l d3,d1 ;the RastPort pointers
- move.l d3,d2 ;etc.
-
- OSW_done move.l sw_screen(a5),a0
- move.l sw_window(a5),a1
-
- unlk a5
- rts
-
-
- * CloseSW(a0,a1)
- * a0 = pointer to Screen
- * a1 = pointer to Window
- * closes screen/window opened by OpenSW()
-
- * NON-MODIFIABLE.
-
-
- CloseSW move.l a0,-(sp) ;save screen ptr
- move.l a1,d0 ;Window exists?
- beq.s CSW_1 ;no
-
- move.l d0,a0
- CALLINT CloseWindow ;else close it
-
- CSW_1 move.l (sp)+,a0
- CALLINT CloseScreen ;and close the screen
- rts
-
-
- * MakeOwnRastPort(a0) -> d0
- * a0 = ptr to BitMap to attach to it
- * if wanted, NULL if none available.
-
- * Create a RastPort if possible.
- * returns D0=NULL if failed,
- * D0=ptr to RastPort if succeeded
-
- * d0/d1/a1/a5 corrupt
-
-
- MakeOwnRastPort movem.l a0/a5,-(sp)
-
- move.l #rp_sizeof,d0 ;create a
- move.l #MEMF_VARS,d1 ;RastPort struct
- CALLEXEC AllocMem
- move.l d0,a5
- tst.l d0 ;get one?
- beq.s MORP_done ;no, bye
-
- move.l d0,a1 ;make it a real
- CALLGRAF InitRastPort ;RastPort
-
- move.l (sp),d0 ;got a BitMap?
- beq.s MORP_ok ;no, don't link in
-
- move.l d0,rp_BitMap(a5) ;else link in BitMap
-
- MORP_ok move.l a5,d0 ;pointer to RastPort
-
- MORP_done movem.l (sp)+,a0/a5
- rts
-
-
-
-
- * KillOwnRastPort(a0)
- * a0 = ptr to RastPort to get rid of
- * won't do it if RaspPort doesn't exist.
-
- * d0/d1/a1/a5 corrupt
-
-
- KillOwnRastPort move.l a0,d0 ;check if RastPort exists
- beq.s KORP_done ;it doesn't so exit
-
- move.l d0,a1
- move.l #rp_sizeof,d0
- CALLEXEC FreeMem ;get rid of it.
-
- KORP_done rts
-
-
- * DisplayGrid(a6)
- * a6 = ptr to main program variables
-
- * Display the crossword grid on the backdrop window.
-
- * d0-d6/a0-a1 corrupt
-
-
- DisplayGrid move.l grid_bmap(a6),a0
-
- move.w grid_firstx(a6),d0
- move.w grid_firsty(a6),d1
-
- subq.w #1,d0 ;convert to pixel
- mulu #SQ_X,d0 ;coordinates
- ; addq.w #2,d0
-
- subq.w #1,d1
- mulu #SQ_X,d1
- ; addq.w #2,d1
-
- move.l mw_rastport(a6),a1 ;window rastport!
-
- move.w grid_hl(a6),d2
- move.w grid_vl(a6),d3
-
- move.w grid_across(a6),d4
- move.w #MAX_DISPX,d6
- cmp.w d6,d4
- bls.s DGR_1
- move.w d6,d4
-
- DGR_1 move.w grid_down(a6),d5
- move.w #MAX_DISPY,d6
- cmp.w d6,d5
- bls.s DGR_2
- move.w d6,d5
-
- DGR_2 mulu #SQ_X,d4
- addq.w #4,d4
-
- mulu #SQ_Y,d5
- addq.w #4,d5
- move.w #$CC,d6
-
- CALLGRAF BltBitMapRastPort
-
- rts
-
-
- * FillBlack2(a6)
- * a6 = ptr to main program variables.
-
- * Faster fillblack routine!
-
- * d0-d3/a0-a1 corrupt
-
-
- FillBlack2 btst #6,applic_flag1(a6) ;what crossword type?
- bne FB2_Done ;not valid for Type 2!
-
- btst #1,applic_flag2(a6) ;HELP on?
- beq.s FB2_ok ;skip if not
-
- lea Help_BF,a0
- moveq #5,d0
- bsr _PopUpQR
-
- beq FB2_Done
-
- FB2_ok move.l grid_array(a6),a0 ;ptr to grid array
-
- moveq #0,d2 ;value to use
-
- move.w grid_across(a6),d0 ;no of across elements
- bra.s FB2_A1
- FB2_L1 move.w grid_down(a6),d1 ;no of down elements
- bra.s FB2_A2
- FB2_L2 move.w d2,(a0)+ ;clear array element
- FB2_A2 dbra d1,FB2_L2 ;back for more
- FB2_A1 dbra d0,FB2_L1 ;back for more
-
-
- * Now clear the graphic area. Use the appropriate RectFill() calls to
- * do this.
-
-
- move.l grid_rp(a6),a1 ;set pen to
- moveq #1,d0 ;white
- CALLGRAF SetAPen
-
- move.w grid_across(a6),d2 ;now fill area
- move.w grid_down(a6),d3 ;with white
- mulu #SQ_X,d2
- mulu #SQ_Y,d3
- addq.l #3,d2
- addq.l #3,d3
- moveq #0,d0
- moveq #0,d1
- move.l grid_rp(a6),a1
-
- movem.l d0-d3/a1,-(sp) ;save parameters
-
- CALLGRAF RectFill
-
- move.l grid_rp(a6),a1 ;set pen to
- moveq #0,d0 ;black
- CALLGRAF SetAPen
-
- movem.l (sp)+,d0-d3/a1 ;recover parameters
-
- addq.l #2,d0
- addq.l #2,d1
- subq.l #2,d2
- subq.l #2,d3
-
- CALLGRAF RectFill ;now fill squares area
-
- bsr DisplayGrid
-
- bsr FreeText
-
- bsr DisposeClueList
-
- bsr InitUndo
-
- clr.w WSCount(a6) ;no more white squares
- clr.w SLCount(a6) ;no more solutions entered
-
- FB2_Done rts
-
-
- * FillWhite2(a6)
- * a6 = ptr to main program variables
- * Faster white fill routine for filling crossword
- * grid.
-
- * Assumes type 1 grid (normal crossword), but also used for
- * initialising a type 2 grid because of its action. Also
- * kills clue lists off because they'll no longer be valid.
-
- * d0-d3/a0-a1 corrupt
-
-
- FillWhite2 btst #1,applic_flag2(a6) ;HELP on?
- beq.s FW2_ok ;skip if not
-
- lea Help_WF,a0
- moveq #5,d0
- bsr _PopUpQR
-
- beq FW2_Done
-
- FW2_ok move.l grid_array(a6),a0 ;ptr to chars grid
- moveq #0,d2
- move.b #" ",d2
- move.w grid_across(a6),d0 ;no of across squares
- bra.s FW2_A1
- FW2_L1 move.w grid_down(a6),d1 ;no of down squares
- bra.s FW2_A2
- FW2_L2 move.w d2,(a0)+ ;set grid element
- FW2_A2 dbra d1,FW2_L2 ;back for more
- FW2_A1 dbra d0,FW2_L1 ;back for more
-
-
- * Now fill the graphic area with white squares.
-
-
- move.l grid_rp(a6),a1 ;set pen to
- moveq #1,d0 ;white
- CALLGRAF SetAPen
-
- move.w grid_across(a6),d2 ;now fill area
- move.w grid_down(a6),d3 ;with white
- mulu #SQ_X,d2
- mulu #SQ_Y,d3
- addq.l #3,d2
- addq.l #3,d3
- moveq #0,d0
- moveq #0,d1
- move.l grid_rp(a6),a1
-
- movem.w d2-d3,-(sp) ;save end coords
-
- CALLGRAF RectFill
-
- move.l grid_rp(a6),a1
- moveq #RP_JAM1,d0
- CALLGRAF SetDrMd
-
- move.l grid_rp(a6),a1
- moveq #0,d0
- CALLGRAF SetAPen
-
- moveq #2,d0
- moveq #2,d1
- move.l grid_rp(a6),a1
- CALLGRAF Move
-
- movem.w (sp),d0-d1
- subq.w #2,d0
- moveq #2,d1
- move.l grid_rp(a6),a1
- CALLGRAF Draw
-
- movem.w (sp),d0-d1
- subq.w #2,d0
- subq.w #2,d1
- move.l grid_rp(a6),a1
- CALLGRAF Draw
-
- movem.w (sp)+,d0-d1
- moveq #2,d0
- subq.w #2,d1
- move.l grid_rp(a6),a1
- CALLGRAF Draw
-
- moveq #2,d0
- moveq #2,d1
- move.l grid_rp(a6),a1
- CALLGRAF Draw
-
- move.w grid_across(a6),d2 ;counter
- subq.w #1,d2 ;1 less needed
- moveq #SQ_X+1,d0 ;start coords
- moveq #2,d1
- move.w grid_down(a6),d3
- mulu #SQ_Y,d3
- addq.w #1,d3
- move.l grid_rp(a6),a1
-
- FW2_L3 movem.l d0-d3/a1,-(sp) ;save drawing parameters
- CALLGRAF Move ;set start drawing pos
- movem.l (sp),d0-d3/a1 ;get parms back
- move.w d3,d1
- CALLGRAF Draw ;now draw vertical line
- movem.l (sp),d0-d3/a1
- addq.w #1,d0 ;start 1 pixel along
- CALLGRAF Move
- movem.l (sp),d0-d3/a1
- move.w d3,d1
- addq.w #1,d0
- CALLGRAF Draw ;draw another vertical line
- movem.l (sp)+,d0-d3/a1
- add.w #SQ_X,d0 ;next position
- subq.w #1,d2 ;done them all?
- bne.s FW2_L3 ;back for more if not
-
- move.w grid_down(a6),d2 ;counter
- subq.w #1,d2 ;1 less needed
- moveq #2,d0 ;start coords
- moveq #SQ_Y+1,d1
- move.w grid_across(a6),d3
- mulu #SQ_Y,d3
- addq.w #1,d3
- move.l grid_rp(a6),a1
-
- FW2_L4 movem.l d0-d3/a1,-(sp) ;save drawing parameters
- CALLGRAF Move ;set start drawing pos
- movem.l (sp),d0-d3/a1 ;get parms back
- move.w d3,d0
- CALLGRAF Draw ;now draw vertical line
- movem.l (sp),d0-d3/a1
- addq.w #1,d1 ;start 1 pixel down
- CALLGRAF Move
- movem.l (sp),d0-d3/a1
- move.w d3,d0
- addq.w #1,d1
- CALLGRAF Draw ;draw another vertical line
- movem.l (sp)+,d0-d3/a1
- add.w #SQ_Y,d1 ;next position
- subq.w #1,d2 ;done them all?
- bne.s FW2_L4 ;back for more if not
-
- bsr DisplayGrid
-
- bsr FreeText
-
- bsr DisposeClueList
-
- bsr InitUndo
-
- move.w grid_across(a6),d0
- mulu grid_down(a6),d0
-
- move.w d0,WSCount(a6) ;new white square count
- clr.w SLCount(a6) ;no more solutions entered
-
- FW2_Done rts
-
-
- * ClearGrid(a6)
- * a6 = ptr to main program variables
- * remove ALL solutions from crossword grid
-
- * d0-d7/a0-a2 corrupt
-
-
- ClearGrid btst #1,applic_flag2(a6) ;HELP on?
- beq.s CG_ok ;skip if not
-
- lea Help_CG,a0 ;pop up help box
- moveq #5,d0
- bsr _PopUpQR
-
- beq.s CG_Done ;exit if NO hit
- bra.s CG_DoNow ;else execute
-
- CG_ok lea CGWarn,a0 ;if no help, pop up
- lea QRT_1(pc),a1 ;a warning QueryReq
- moveq #5,d0
-
- move.l a0,irt_tlist(a6)
- move.l a1,irt_itext(a6)
- move.w d0,irt_count(a6)
-
- bsr DoQueryReq
-
- btst #6,applic_flag2(a6) ;YES gadget hit
- beq.s CG_Done ;skip if not
-
- CG_DoNow move.l grid_array(a6),a0 ;ptr to chars grid
-
- move.w grid_down(a6),d6 ;no of squares down
- bra.s CG_a1
-
- CG_l1 move.w grid_across(a6),d7 ;no of squares across
- bra.s CG_a2
-
- CG_l2 move.w (a0),d2 ;get whole data
- tst.b d2 ;check black/white square
- beq.s CG_b1 ;black so leave it
-
- move.b #" ",d2 ;else set blank white square
- move.w d2,(a0) ;set grid byte
-
- movem.l d6-d7/a0,-(sp) ;save ptrs to grid etc
-
- move.w grid_across(a6),d0
- sub.w d7,d0 ;get across grid pos
- move.w grid_down(a6),d1
- sub.w d6,d1 ;and down grid pos
-
- bsr SetSquare ;set square
-
- movem.l (sp)+,d6-d7/a0 ;recover ptrs to grid etc
-
- CG_b1 addq.l #2,a0 ;point to next grid square
-
- CG_a2 dbra d7,CG_l2
-
- CG_a1 dbra d6,CG_l1
-
- bsr DisplayGrid
-
- bsr InitUndo
-
- bsr SetUnsolved
-
- clr.w SLCount(a6) ;no more solutions entered
-
- CG_Done rts
-
-
- * SetSquare(a6,d0,d1,d2)
- * a6 = ptr to main program variables
- * d0 = across square #
- * d1 = down square #
- * d2 = char to set it to (0 for black square, " " for blank white square)
-
- * Set grid square colour & pop in any char passed to the routine
- * if it's a white square.
-
- * Convention :
-
- * 0 = black square
- * nonzero = white square + ASCII char value required
- * to display character in grid square
-
- * Note:char in d2.b. High byte of d2.w contains the data for the
- * horizontal & vertical bars for Daily Express Small Crossword type
- * grid squares.
-
- * d0-d6/a0-a1 corrupt
-
-
- SetSquare lea sqtable(pc),a0 ;ptr to square data ptrs
-
- and.w #$3FF,d2 ;ensure safe char parms
-
- moveq #0,d3
- move.b d2,d3
- sne d3 ;either 0 or -1
- neg.b d3 ;now either 0 or 1
- add.w d3,d3 ;adjust to longword offset
- add.w d3,d3
- lea 0(a0,d3.w),a0 ;get ptr to square data
-
- move.w d2,d3
- lsr.w #8,d3 ;get type 2 data
- add.w d3,d3
- add.w d3,d3 ;now 0,1,2 or 3
- lea 0(a0,d3.w),a0 ;get ptr to square data
- move.l (a0),a0 ;and get ptr to bitmap to use
-
- subq.w #1,d0
- mulu #SQ_X,d0 ;convert to pixel pos
- addq.w #2,d0
-
- subq.w #1,d1
- mulu #SQ_Y,d1 ;convert to pixel pos
- addq.w #2,d1
-
- movem.w d0-d2,-(sp) ;save pixel pos etc
-
- move.w d0,d2 ;destination x & y
- move.w d1,d3 ;coordinates
- moveq #0,d0 ;src x & y coordinates
- move.l d0,d1
- move.l grid_rp(a6),a1 ;ptr to dest rastport
- moveq #10,d4 ;how much of BitMap to
- moveq #10,d5 ;copy across
- move.w #$CC,d6 ;minterm D=B
- CALLGRAF BltBitMapRastPort ;and transfer it
-
- CALLGRAF WaitBlit ;Do 2 calls just in case!
- CALLGRAF WaitBlit
-
- movem.w (sp)+,d0-d2 ;recover coords etc
-
- lea itsquare(pc),a1
- move.l 12(a1),a2 ;ptr to itext
-
- move.b d2,(a2)+ ;insert char
- clr.b (a2) ;ensure ASCIIZ text
-
- move.b d2,d3 ;black or not?
- sne d3 ;-1 if white, 0 if black
- neg.b d3 ;1=white, 0=black
- ext.w d3
- add.w d3,WSCount(a6) ;update white square count
-
- move.b d2,d3
- seq d3
- neg.b d3 ;this time 1=black, 0=white
- ext.w d3
- sub.w d3,WSCount(a6) ;update white square count
-
- tst.b d2 ;check if black/non-black
- sne d2 ;make 0 or -1 accordingly
- neg.b d2 ;make 0 or 1
-
- move.b d2,d3
- add.b d2,d2 ;make 0 or 2
- add.b d3,d2 ;make 0 or 3
-
- ; addq.b #1,d2
-
- move.b d2,(a1) ;set fgnd colour to 0 or 3
- move.l grid_rp(a6),a0 ;ptr to grid rastport
- CALLINT PrintIText
-
- rts
-
-
- * Blitter data for squares including bitmaps. Also table of pointers to
- * the bitmaps for ease of access.
-
-
- sqtable dc.l bsbmap ;black square, type 0
- dc.l wsbmap ;white sq type 0 & 1
- dc.l vbsbmap ;type 1 vert bar square
- dc.l hbsbmap ;type 1 horiz bar square
- dc.l bbsbmap ;type 1 double bar square
-
-
- bsbmap dc.w 0,0
- dc.b 0,0
- dc.w 0
- dc.l 0,0
-
- wsbmap dc.w 0,0
- dc.b 0,0
- dc.w 0
- dc.l 0,0
-
- vbsbmap dc.w 0,0
- dc.b 0,0
- dc.w 0
- dc.l 0,0
-
- hbsbmap dc.w 0,0
- dc.b 0,0
- dc.w 0
- dc.l 0,0
-
- bbsbmap dc.w 0,0
- dc.b 0,0
- dc.w 0
- dc.l 0,0
-
-
-
- * IntuiText data for squares
-
-
- itsquare dc.b 0,1 ;colour
- dc.b RP_JAM1,0 ;mode
- dc.w 1,1 ;position
- dc.l 0 ;no font
- dc.l itsqchar ;ptr to chars
- dc.l 0 ;no more itexts
-
- itsqchar dc.b " ",0 ;space char
- even
-
-
- * DoEvent(a0,a5)
- * a0 = ptr to user port to WAIT upon
- * a5 = ptr to Event Handler Block
- * do one read of the user port & handle events once.
- * Note : does NOT handle one event at a time! Rather,
- * checks one event sequence & processes that entire
- * sequence. Written to allow multiple windows to have
- * their own DoEvent() call by virtue of passing different
- * UserPort pointers to it.
-
- * d0/a0-a1 corrupt
-
- * NON-MODIFIABLE.
-
-
- DoEvent move.l a0,-(sp)
- CALLEXEC WaitPort ;Wait for port
- move.l (sp)+,a0
-
- CALLEXEC GetMsg ;now get message
- move.l d0,a1 ;here ascertain type
-
-
- * Here goes code to handle such things as mouse handling in the
- * absence of MENUVERIFY, and implementing MENUCANCEL if wanted.
- * Don't forget to make the code save the message ptr if required!
-
-
- move.l ehb_mousecode(a5),d0 ;code exists?
- beq.s DoEvent_1 ;no-don't execute!
- move.l d0,a0 ;get code pointer
- jsr (a0) ;& execute routine
-
-
- * Now reply the message.
-
-
- DoEvent_1 CALLEXEC ReplyMsg ;reply the message
-
-
- * Now go execute the code required by the given IDCMP message.
-
-
- move.l ehb_othercode(a5),d0 ;code exists?
- beq.s DoEvent_2 ;no-don't execute
- move.l d0,a0 ;get ptr
-
- move.l ehb_IDCMPlist(a5),a1 ;IDCMP list ptr
- move.l event_class(a6),d0 ;IDCMP received
- jsr (a0) ;do it
-
- DoEvent_2 rts
-
-
- * SelectEvent(d0,a1)
- * d0 = IDCMP message received from somewhere else
- * a1 = ptr to IDCMP list to use to decide what to do
- * executes various routines based upon IDCMP message
- * & IDCMP selection list.
-
- * This will be the normal code choice for ehb_othercode in
- * the Event Handler Block structure, but the way it has been
- * written allows alternative ehb_othercode's to exist using
- * this as a basis.
-
- * d1/d2/a1 corrupt by this routine. OTHER CODE
- * CALLED BY THIS ROUTINE MAY WRECK OTHER REGISTERS!
-
- * NON-MODIFIABLE.
-
-
- SelectEvent movem.l (a1)+,d1/d2 ;get flag, code pointer
- tst.l d1 ;end of list?
- beq.s SE_done ;yes!-exit
- and.l d0,d1 ;this IDCMP?
- beq.s SE_1 ;no, skip
- movem.l d0/a1,-(sp) ;else save these
- move.l d2,a1 ;get code pointer
- jsr (a1) ;& execute it
- movem.l (sp)+,d0/a1 ;recover IDCMP msg & list ptr
- SE_1 bra.s SelectEvent ;and do again
-
- SE_done rts
-
-
- * AlterEvent(a1,a6)
- * a1 = ptr to received IntuiMessage
- * a6 = ptr to main program variables
- * Do a GetIM() (see below) and then
- * alter the message before reply if needed.
-
- * d0-d1 corrupt
-
- * MODIFIABLE.
-
-
- AlterEvent bsr.s GetIM
-
- rts
-
-
- * GetIM(a1,a6)
- * a1 = ptr to received IntuiMessage
- * a6 = ptr to main program variables
- * Read the message & store in private variables
- * d0/d1 corrupt
-
- * NON-MODIFIABLE.
-
-
- GetIM move.l im_class(a1),d0
- move.l d0,event_class(a6) ;IDCMP event class
- move.w im_code(a1),d0
- move.w d0,menu_id(a6) ;menu ID selected
- move.w im_qualifier(a1),d0
- move.w d0,shift_stat(a6)
- move.l im_iaddress(a1),d0
- move.l d0,gadget_id(a6) ;address of selected gadget
- move.w im_mousex(a1),d0
- move.w im_mousey(a1),d1
- move.w d0,mouse_xpos(a6)
- move.w d1,mouse_ypos(a6)
-
- rts
-
-
- * DoMenus(a6)
- * a6 = ptr to main program variables.
- * handle Menu event. Relies on menu_id(a6)
- * menu_list(a6) and menu_strip(a6) being
- * properly conditioned.
-
- * d0-d1/a0-a1 corrupt. NOTE: OTHER CODE CALLED BY THIS
- * COULD TRASH OTHER REGISTERS TOO!
-
- * NON-MODIFIABLE.
-
-
- DoMenus move.w menu_id(a6),d0 ;initial MenuNumber
-
- DM_1 move.l menu_list(a6),a0 ;& list for this menu
-
- cmp.w #MENUNULL,d0 ;no real selection?
- beq.s DM_done ;no, so exit cleanly.
-
- * Here real menu selection made. Check which one in list.
-
- DM_2 move.w (a0)+,d1 ;get comparison MenuNumber
- move.l (a0)+,a1 ;& routine to execute for it
-
- cmp.w #MENUNULL,d1 ;end of list?
- beq.s DM_done ;yes, so exit cleanly.
-
- cmp.w d1,d0 ;this menu selection?
- bne.s DM_2 ;no, try another
-
- * Here we've found the one we want. Save MenuNumber
- * then execute the routine.
-
- move.w d0,-(sp) ;save data
- jsr (a1) ;execute routine
-
- * Now recover saved data, & obtain the NextSelect field. If not
- * MENUNULL, process this one as well.
-
- moveq #0,d0 ;ItemAddress() expects LONG!
- move.w (sp)+,d0 ;temp. recover only
- move.l menu_strip(a6),a0
- CALLINT ItemAddress ;point to MenuItem structure
- move.l d0,a0
- move.w mi_NextSelect(a0),d0 ;get NextSelect
- move.l menu_list(a6),a0 ;and compare list
- bra.s DM_1 ;and check again.
-
- * Get here when finished!
-
- DM_done rts
-
-
- * DoIGadget(a6)
- * a6 = ptr to main variables
-
- * Execute a GADGIMMEDIATE routine.
-
- * Only uses gg_UserData.
-
-
- DoIGadget move.l gadget_id(a6),d0 ;get gadget ID
- beq.s DoneIG ;not a real one
- move.l d0,a0
- move.l gg_UserData(a0),d0 ;get routine ptr
- beq.s DoneIG ;there isn't one
- move.l d0,a0
- jmp (a0) ;else execute it
- DoneIG rts
-
-
- * DoRGadget(a6)
- * a6 = ptr to main variables
-
- * Execute a RELVERIFY routine.
-
- * Only uses gg_UserData+4.
-
-
- DoRGadget move.l gadget_id(a6),d0 ;get gadget ID
- beq.s DoneRG ;not a real one
- move.l d0,a0
- move.l gg_UserData+4(a0),d0 ;get routine ptr
- beq.s DoneRG ;there isn't one
- move.l d0,a0
- jmp (a0) ;else execute it
- DoneRG rts
-
-
- * DoGadget(a6)
- * a6 = ptr to main program variables
- * execute a routine associated with a gadget.
- * This routine checks the gg_userdata field
- * first, & executes routine if present. If
- * not, gets gg_GadgetID and uses as index into
- * table of gadget jump addresses. If GadgetID
- * is zero, routine exits. If both RELVERIFY
- * and GADGIMMEDIATE set, and this routine is
- * attached to both GADGETUP/GADGETDOWN IDCMP,
- * then for a given gadget this routine will
- * be executed twice.
-
- * JMP (A0) assumes that each routine called ends
- * in RTS. This RTS returns to caller of DoGadget().
-
- * d0/a0/a1 corrupt
-
- * NON-MODIFIABLE.
-
-
- DoGadget move.l gadget_id(a6),d0 ;get gadget addr ptr
- beq.s DG_Done ;not a real one!
-
- move.l d0,a0
- move.l gadget_list(a6),a1 ;jump table list
-
- move.l gg_UserData(a0),d0 ;get gg_userdata
- beq.s DG_1 ;nonexistent so skip
-
- move.l d0,a0 ;get execution addr
- jmp (a0) ;& execute it
-
- DG_1 move.w gg_GadgetID(a0),d0 ;get gg_GadgetID
- beq.s DG_Done ;nonexistent so skip
-
- ext.l d0
- add.l d0,d0
- add.l d0,d0 ;longword index!
-
- move.l 0(a1,d0.l),d0 ;get execution address
- beq.s DG_Done ;invalid-quit now!
- move.l d0,a0 ;else get execution addr
- jmp (a0) ;and do it!
-
- DG_Done rts
-
-
- * DoMouseMove(a6)
- * a6 = ptr to main program variables
-
- * Handle mouse movement functions.
-
- * d0-d2 corrupt
-
-
- DoMouseMove move.w mp_across(a6),oldmpac(a6) ;save old square
- move.w mp_down(a6),oldmpdn(a6) ;pointer posn's
-
- move.l mw_handle(a6),a0 ;ptr to Window structure
-
- btst #3,applic_flag1(a6) ;picking a clue?
- bne.s DMM_5 ;skip if so
-
- move.w mouse_ypos(a6),d0 ;get mouse ptr vert posn
- cmp.w #ON_MENU,d0 ;is it on menu bar?
- bcs.s DMM_1 ;skip if it is
-
- DMM_5 bset #0,25(a0) ;set RMBTRAP if not
- bra.s DMM_2
-
- DMM_1 bclr #0,25(a0) ;clear RMBTRAP if yes
-
- DMM_2 moveq #0,d0 ;clear regs for later DIVU!
- move.l d0,d1
- moveq #-1,d2
-
- move.w d2,mp_across(a6) ;values for mouse ptr off
- move.w d2,mp_down(a6) ;crossword grid
-
- move.w mouse_xpos(a6),d0 ;get mouse horiz position
- cmp.w grid_hl(a6),d0 ;off left edge of grid?
- bcs DMM_Done ;yes, so exit NOW
-
- cmp.w grid_hu(a6),d0 ;off right edge of grid?
- bhi DMM_Done ;yes, so exit NOW
-
- move.w mouse_ypos(a6),d1 ;get mouse vert position
- cmp.w grid_vl(a6),d1 ;off top edge of grid?
- bcs DMM_Done ;yes, so exit NOW
-
- cmp.w grid_vu(a6),d1 ;off bottom edge of grid?
- bhi DMM_Done
-
-
- * Here compute which square is being addressed.
-
-
- sub.w grid_hl(a6),d0
- divu #SQ_X,d0
- add.w grid_firstx(a6),d0
- move.w d0,mp_across(a6)
-
- sub.w grid_vl(a6),d1
- divu #SQ_Y,d1
- add.w grid_firsty(a6),d1
- move.w d1,mp_down(a6)
-
- subq.w #1,d1 ;vert square no -1
- mulu grid_across(a6),d1 ;* no of squares across
- subq.w #1,d0 ;horiz square -1
- ext.l d0
- add.l d1,d0 ;add on
- add.l d0,d0 ;*2 for word offset
-
- move.l d0,grid_offset(a6)
-
-
- * if changing squares on normal crossword grid, change them.
-
-
- move.b applic_flag1(a6),d0 ;get flags
- move.b d0,d1
- btst #3,d0 ;picking a clue?
- bne.s DMM_3 ;skip if so
-
- and.b #%11,d1 ;get mouse bits only
- beq.s DMM_3 ;no mouse bits so skip
-
- move.w mp_across(a6),d0 ;pointing to a
- cmp.w oldmpac(a6),d0 ;new square?
- bne.s DMM_4 ;continue if so
-
- move.w mp_down(a6),d0
- cmp.w oldmpdn(a6),d0
- beq.s DMM_3 ;continue if so
-
- DMM_4 move.l grid_offset(a6),a0 ;ptr to current square
- move.l a0,a1
- add.l grid_array(a6),a0 ;ptr to grid element
- add.l undo_array(a6),a1 ;ptr to undo element
-
- move.w currsq(a6),d0 ;get square change value
- tst.b d0 ;change to black square?
- beq.s DMM_6 ;skip if so
- move.w (a1),d1 ;get undo char
- tst.b d1 ;accidentally black?
- bne.s DMM_8
- move.b #" ",d1 ;force blank white square
- DMM_8 move.b d1,d0 ;copy to square
- ; move.w d0,(a1) ;save in undo array
- move.w d0,currsq(a6) ;& enforce square change
- bra.s DMM_7
-
- DMM_6 move.w (a0),(a1) ;save current square
-
- DMM_7 bsr SquareChange ;here change new square
- ; bra.s DMM_3
-
-
- * Here, display the square information.
-
-
- DMM_3 lea MPValues(pc),a0
- move.w mp_across(a6),d0
- moveq #2,d1
- bsr ItoA
-
- move.l mw_rastport(a6),a0
- lea MPInfo(pc),a1
- move.w #PG_RPOS+83,d0
- move.w #PG_UPOS+7,d1
- CALLINT PrintIText
-
- lea MPValues(pc),a0
- move.w mp_down(a6),d0
- moveq #2,d1
- bsr ItoA
-
- move.l mw_rastport(a6),a0
- lea MPInfo(pc),a1
- move.w #PG_RPOS+83,d0
- move.w #PG_UPOS+37,d1
- CALLINT PrintIText
-
- bsr DisplayGrid
-
- DMM_Done rts
-
-
- MPInfo dc.b 1,0
- dc.b RP_JAM2,0
- dc.w 0,0
- dc.l 0 ;no font
- dc.l MPValues ;ptr to chars
- dc.l 0 ;no more itexts
-
-
- MPValues dc.b " ",0
- even
-
-
-
- * DoMouseButton(a6)
- * a6 = ptr to main program variables
-
- * Handle mouse button functions.
-
- * Performs the following:
-
- * 1) Check mouse position when button(s) pressed.
-
- * 2) If ptr on menu bar, exit-nothing else needs to be done.
-
- * 3) If ptr on grid, execute square changing code. See below for
- * modus operandi.
-
- * 4) If picking a clue for the clue editing or solution
- * editing functions, then don't do the square changing.
-
- * Note also that this routine will abort if user has a requester up
- * to prevent menu deadlocking.
-
- * New for 1.2:undo array for remembering letters contained within
- * grid squares if accidentally clicked upon.
-
- * d0-d7/a0-a2 corrupt
-
-
- DoMouseButton tst.w ReqCount(a6) ;in a requester?
- bne DoneMB ;quit if so
-
- move.w menu_id(a6),d0 ;check button status
- cmp.w #SELECTDOWN,d0 ;LMB pressed?
- bne.s DMB_1 ;skip if not
-
- or.b #5,applic_flag1(a6) ;set LM,C flags
-
- ; bset #0,applic_flag1(a6) ;set LM flag
- ; bset #2,applic_flag1(a6) ;and C flag
- bra.s DMB_4
-
- DMB_1 cmp.w #SELECTUP,d0 ;LMB released?
- bne.s DMB_2 ;skip if not
-
- move.b #$FA,d0 ;clear LM,C flags
- tst.w mp_across(a6) ;on a grid square?
- bmi.s DMB_1_1 ;skip if not
- bclr #3,d0 ;else clear P flag
-
- ; and.b #$F2,applic_flag1(a6) ;clear LM,C,P flags
-
- DMB_1_1 and.b d0,applic_flag1(a6) ;clear req'd flags
-
- ; bclr #0,applic_flag1(a6) ;clear LM flag
- ; bclr #2,applic_flag1(a6) ;and C flag
- bra.s DMB_4
-
- DMB_2 cmp.w #MENUDOWN,d0 ;RMB pressed?
- bne.s DMB_3 ;skip if not
-
- or.b #6,applic_flag1(a6) ;set RM,C flags
-
- ; bset #1,applic_flag1(a6) ;set RM flag
- ; bset #2,applic_flag1(a6) ;and C flag
- bra.s DMB_4
-
- DMB_3 cmp.w #MENUUP,d0 ;RMB released?
- bne.s DMB_4 ;skip if not
-
- move.b #$F9,d0 ;clear LM,C flags
- tst.w mp_across(a6) ;on a grid square?
- bmi.s DMB_3_1 ;skip if not
- bclr #3,d0 ;else clear P flag
-
- ; and.b #$F1,applic_flag1(a6) ;clear RM,C,P flags
-
- DMB_3_1 and.b d0,applic_flag1(a6) ;else clear req'd flags
-
- ; bclr #1,applic_flag1(a6) ;clear RM flag
- ; bclr #2,applic_flag1(a6) ;and C flag
-
-
- * Here, check if picking a clue. If so, save the square
- * position, and exit without doing anything more.
-
-
- DMB_4 btst #3,applic_flag1(a6) ;picking a clue?
- beq.s DMB_8 ;skip if not
-
- tst.w mp_across(a6) ;got a proper square?
- bmi DoneMB ;no, exit
-
- move.l grid_offset(a6),a0
- add.l grid_array(a6),a0
-
- tst.b 1(a0) ;black square?
- beq DoneMB ;exit if so
-
- move.w mp_across(a6),pick_hpos(a6) ;else save
- move.w mp_down(a6),pick_vpos(a6) ;position
- move.l grid_offset(a6),pick_offset(a6)
-
- bclr #2,applic_flag1(a6) ;Clear my C flag
-
- rts
-
-
- * Here determine what sort of square change to make.
- * Get current square type, and force a change. Store the
- * change, and store the changed value in the main vars table.
- * Use this in SquareChange() for future square changes when
- * mouse buttons held down.
-
-
- DMB_8 move.w mp_across(a6),d0 ;on the grid?
- bmi DoneMB ;no so skip
-
- move.w mp_down(a6),d1 ;on the grid?
- bmi DoneMB ;no so skip
-
- move.l grid_offset(a6),a0
- move.l a0,a1
- add.l grid_array(a6),a0 ;get ptr to array word
- add.l undo_array(a6),a1
-
- move.w (a0),d2 ;get grid data
-
- tst.b d2 ;black square?
- beq.s DMB_yy ;continue if so
-
- move.w d2,(a1) ;else save current state
-
- ; move.w d2,savechar(a6) ;else save char
- ; move.w d0,save_h(a6) ;and position
- ; move.w d1,save_v(a6)
-
- DMB_yy move.b applic_flag1(a6),d0 ;get LMB/RMB etc
- move.b #%11,d1 ;temp mask for type 2
-
- btst #6,d0 ;type 2 crossword?
- bne.s DMB_5 ;skip if so
- clr.b d1 ;else temp mask for type 1
-
- DMB_5 and.b d0,d1 ;create appropriate true mask
-
- lsl.w #8,d1 ;if type 2 crossword, change
- eor.w d1,d2 ;any type 2 bits, force type 1=0
-
- move.w d2,d1 ;copy resulting square data
- btst #6,d0 ;Type 2 crossword?
- beq.s DMB_6 ;skip if not
- ; move.b #" ",d1 ;else force white square
- move.w (a1),d1 ;else force white & prev char
- bra.s DMB_7 ;and make the change
-
- DMB_6 tst.b d1 ;state of low byte?
- seq d1 ;if 0, make -1, if not 0, make 0
- tst.b d1 ;result zero?
- beq.s DMB_7 ;skip if so
- ; move.b #" ",d1 ;else force blank white square
- move.w (a1),d1 ;else force white & prev char
-
-
- * At this point bits 8 & 9 of d2 contain type 2 bits. So now
- * pop in any ASCII char data into bits 0-7.
-
-
- DMB_7 move.b d1,d2 ;create grid word
- move.w d2,currsq(a6) ;save the new square data
-
- ; move.w (a0),d2 ;get original square data
- ; move.w d2,(a1) ;save in undo array
-
- btst #2,d0 ;changing the square?
- beq.s DoneMB ;skip if not
-
- ; move.w d0,save_h(a6) ;save current pos
- ; move.w d1,save_v(a6)
-
- DMB_xx move.w (a0),d0 ;get current square data
-
- bsr SquareChange ;else force the square change
-
- bsr DisplayGrid ;show any results
-
- DoneMB rts ;done!
-
-
- * SquareChange(a6)
- * a6 = ptr to main variables
-
- * change state of currently pointed to square
- * according to mouse button data.
-
- * NEW for 1.2 : checks if editing allowed!
-
- * d0-d3/a0-a1 corrupt
-
-
- SquareChange move.w mp_across(a6),d0 ;get square row & col
- bmi.s SCH_Done ;exit if not on square!
- move.w mp_down(a6),d1
- bmi.s SCH_Done ;ditto...
-
- tst.b editon(a6) ;editing allowed?
- bne.s SCH_Done ;skip if not
-
- move.l grid_offset(a6),a0 ;get grid array element
- add.l grid_array(a6),a0 ;address
-
- move.w currsq(a6),d2
-
- SCH_1 move.w d2,(a0) ;change array byte
-
- bsr SetSquare ;and alter square on grid
-
- SCH_Done rts
-
-
- * AltMouseButton(a6)
- * a6 = ptr to main program variables
-
- * Alternative mouse button handler for within a requester.
-
- * corrupt
-
- AltMouseButton and.b #$FB,applic_flag1(a6) ;clear C flag
-
- move.w menu_id(a6),d0 ;check button status
- cmp.w #SELECTDOWN,d0 ;LMB pressed?
- bne.s AMB_1 ;skip if not
-
- or.b #1,applic_flag1(a6) ;set LM flag
- bra.s AMB_4
-
- AMB_1 cmp.w #SELECTUP,d0 ;LMB released?
- bne.s AMB_2 ;skip if not
-
- and.b #$FE,applic_flag1(a6) ;clear LM flag
- bra.s AMB_4
-
- AMB_2 cmp.w #MENUDOWN,d0 ;RMB pressed?
- bne.s AMB_3 ;skip if not
-
- or.b #2,applic_flag1(a6) ;set RM flag
- bra.s AMB_4
-
- AMB_3 cmp.w #MENUUP,d0 ;RMB released?
- bne.s AMB_4 ;skip if not
-
- and.b #$FD,applic_flag1(a6) ;clear LM flag
-
- AMB_4 rts
-
-
- * HandleRequest(a4)
- * a4 = ptr to Requester handling block
-
- * Handle all custom requesters except for DMRequesters,
- * this routine kills off any VERIFY IDCMPs and then
- * resets the original window IDCMP once ALL of the
- * requesters are no longer active. Saves lots of
- * needless hassle for other programmers using this
- * code. Also sets RMBTRAP on the fly, preventing an
- * accidental menu access. Note that it won't clear the
- * RMBTRAP flag - that has to be done by the programmer
- * if wanted once requester handling finished.
-
- * NEVER CALL THIS WITHOUT INITIALISING THE rhb_ STRUCTURE
- * BEFOREHAND!
-
- * Note that this system maintains its integrity only if there
- * is one window to condition. If several windows needed, then
- * use this as a basis for a rewrite.
-
- * Does not reactivate the window anymore-that's YOUR job!
-
- * ASSUME ALL REGISTERS CORRUPT-OTHER CODE ACTIVATED
- * BY THIS ROUTINE!
-
- * MODIFIABLE
-
-
- HandleRequest move.l a4,-(sp) ;save for nested requesters!
-
- move.l rhb_Window(a4),a0 ;prepare to recondition
- bset #0,25(a0) ;(set RMBTRAP also!)...
- move.l #REQSET,d0 ;IDCMP for WAIT
- CALLINT ModifyIDCMP
-
- bset #7,applic_flag2(a6) ;set requester on flag
-
- addq.w #1,ReqCount(a6) ;1 more active Req
-
- move.l rhb_Requester(a4),a0 ;this requester
- move.l rhb_Window(a4),a1 ;this window
- CALLINT Request ;set it up
-
-
- * Here, wait for REQSET so that the PreCode functions properly (especially
- * if it's a call to ActivateGadget()!!)
-
-
- HReq_W1 move.l rhb_EHB(a4),a5 ;get event block
- move.l rhb_UserPort(a4),a0 ;& user port
- bsr DoEvent ;Event driven!
-
- btst #7,applic_flag2(a6) ;requester on?
- bne.s HReq_W1 ;back if not
-
- move.l rhb_Window(a4),a0 ;prepare to recondition
- move.l rhb_IDCMP(a4),d0 ;IDCMPs
-
- bset #0,25(a0) ;set RMBTRAP also!
-
- move.l #SIZEVERIFY,d1
- or.l #MENUVERIFY,d1
- or.l #REQVERIFY,d1
-
- not.l d1
- and.l d1,d0 ;kill off all VERIFYs!
-
- CALLINT ModifyIDCMP
- bset #7,applic_flag2(a6) ;set requester on flag
-
- move.l rhb_PreCode(a4),d0 ;any PreCode to run?
- beq.s HReq_1 ;skip if not
-
- move.l d0,a0 ;else prepare to run it
- jsr (a0) ;GO!
-
- HReq_1 move.l rhb_EHB(a4),a5 ;get event block
- move.l rhb_UserPort(a4),a0 ;& user port
- bsr DoEvent ;Event driven!
-
- bset #7,applic_flag2(a6) ;left requester?
- bne.s HReq_1 ;back if not
-
- move.l (sp)+,a4 ;recover for nested calls!
-
- subq.w #1,ReqCount(a6) ;1 fewer req's active
- bne.s HReq_2 ;skip if any still active
-
- move.l rhb_Window(a4),a0 ;else restore the
- move.l rhb_IDCMP(a4),d0 ;original IDCMP
-
- CALLINT ModifyIDCMP
-
- bclr #7,applic_flag2(a6) ;signal no more reqs
-
- ; move.l rhb_Window(a4),a0 ;and reactivate
- ; CALLINT ActivateWindow ;the window.
-
- HReq_2 rts
-
-
- * ItoA(a0,d0,d1)
- * a0 = ptr to buffer into which to put the resulting string
- * d0 = value to convert
- * d1 = field width for resulting string
-
- * d1-d3/a1 corrupt
-
-
- ItoA move.l a0,a1 ;copy buffer ptr
-
- move.w d1,d2 ;copy field width
- bra.s ItoA_a1
-
- ItoA_l1 move.b #" ",(a1)+ ;space padding for string
-
- ItoA_a1 dbra d2,ItoA_l1
-
- clr.b (a1) ;and terminating EOS
-
- move.w d0,d3 ;copy initial value
-
- ItoA_l2 moveq #0,d2
- move.w d3,d2 ;ensure word sized operand
-
- divu #10,d2 ;get trailing digit
- move.w d2,d3 ;save quotient
- swap d2
- add.b #"0",d2 ;create ASCII digit
- move.b d2,-(a1) ;& save it
-
- subq.w #1,d1 ;used entire fieldwidth?
- beq.s ItoA_b1 ;exit if so
-
- tst.w d3 ;quotient = 0?
- bne.s ItoA_l2 ;back for more if not
-
- ItoA_b1 rts ;done
-
-
- * MakeNewGrid(a6)
- * a6 = ptr to main program variables
-
- * Pop up the "New Crossword" requester & get details.
- * Then if confirmed, create the new grid.
-
- * ThisReq(a6) should point to an rhb_ structure (or at least
- * an area of memory usable as one). The ENTIRE rhb_ structure
- * is now initialised by this routine.
-
- * ALL REGISTERS CORRUPT
-
-
- MakeNewGrid btst #1,applic_flag2(a6) ;HELP on?
- beq.s MNG_ok ;skip if not
-
- lea Help_NG(pc),a0 ;do help
- moveq #6,d0
- bsr _PopUpQR
-
- beq MNG_Done ;and skip if aborted
-
- MNG_ok move.w grid_across(a6),tmp_across(a6) ;copy these
- move.w grid_down(a6),tmp_down(a6)
-
-
- * Now initialise rhb_ structure for HandleRequest() and TURN OFF the
- * ReportMouse status of the window!
-
-
- move.l ThisReq(a6),a4
-
- move.l mw_handle(a6),rhb_Window(a4)
- move.l mw_userport(a6),rhb_UserPort(a4)
- move.l mw_IDCMP(a6),rhb_IDCMP(a4)
- lea NewCWReq(pc),a0
- move.l a0,rhb_Requester(a4)
- lea ehb_req(pc),a0
- move.l a0,rhb_EHB(a4)
-
- ; lea SetHVPots1(pc),a0
- lea InitNCGadgets(pc),a0
- move.l a0,rhb_PreCode(a4)
-
- ; clr.l rhb_PreCode(a4)
-
- bclr #6,applic_flag2(a6) ;CANCEL flag
-
- move.l rhb_Window(a4),a0 ;this window
- moveq #0,d0 ;FALSE
- ; exg d0,a0 ;WARNING - change order!
- CALLINT ReportMouse ;and stop mouse reports!
-
- bsr HandleRequest ;do the requester
-
- btst #6,applic_flag2(a6) ;CANCEL gadget?
- beq.s MNG_Done ;skip if so
-
- bsr ReplaceGrid ;generate new grid
-
- ; bsr FreeText ;kill any previous
-
- ; bsr DisposeClueList ;clue list etc
-
- MNG_Done move.l rhb_Window(a4),a0 ;this window
- moveq #-1,d0 ;TRUE
- ; exg d0,a0 ;WARNING - change order!
- CALLINT ReportMouse ;and re-enable mouse reports
-
- move.l mw_handle(a6),a0 ;back to my window
- CALLINT ActivateWindow
-
- rts
-
-
- * SetHVPots1(a6)
- * a6 = ptr to main program variables
- * Sets the proportional gadgets coupled to the
- * "New Crossword" requester and the string
- * gadgets also.
-
- * d0-d5/a0-a2 corrupt
-
-
- SetHVPots1 lea NC_HPot(pc),a0 ;ptr to HPot gadget
- move.l mw_handle(a6),a1
- move.l ThisReq(a6),a2
- move.l rhb_Requester(a2),a2
-
- move.w #FREEHORIZ+PROPBORDERLESS,d0 ;set flags
-
- moveq #1,d3
- neg.w d3
- divu #MAXSQ_X,d3 ;create HorizBody
- move.w d3,d1
- mulu tmp_across(a6),d1 ;and HorizPot
- moveq #-1,d2 ;Vertical values are
- moveq #-1,d4 ;all -1
- moveq #1,d5 ;refresh no other gadgets
- CALLINT NewModifyProp
-
-
- lea NC_VPot(pc),a0 ;ptr to HPot gadget
- move.l mw_handle(a6),a1
- move.l ThisReq(a6),a2
- move.l rhb_Requester(a2),a2
-
- move.w #FREEVERT+PROPBORDERLESS,d0 ;set flags
-
- moveq #1,d4
- neg.w d4
- divu #MAXSQ_Y,d4 ;create VertBody
- move.w d4,d2
- mulu tmp_down(a6),d2 ;and VertPot
- neg.w d2 ;inverted Y axis!
- moveq #-1,d1 ;Horiz values are
- moveq #-1,d3 ;all -1
- moveq #1,d5 ;refresh no other gadgets
- CALLINT NewModifyProp
-
- rts
-
-
- * InitNCGadgets(a6)
- * a6 = ptr to main program variables
-
- * Initialise all of the "New Crossword" requester
- * gadgets that need pre-initialisation.
-
- * d0-d2/a0-a2/a5 corrupt
-
-
- InitNCGadgets bsr SetHVPots1
- bsr ResetAcross
- bsr ResetDown
-
- rts
-
-
- * ReplaceGrid(a6)
- * a6 = ptr to main program variables
-
- * Try to create new grid using tmp_ variables,
- * and if it can be done, destroy the old one
- * and replace the destroyed old one with the
- * newly created one.
-
- * d0-d2/a0-a1 corrupt
-
-
- ReplaceGrid move.l #MEMF_VARS,d1
- CALLEXEC AvailMem ;how much memory left?
-
-
- * Now compute how much memory will be free when we get rid of the
- * current grid array & undo array.
-
-
- move.l d0,d1 ;save amount left
- move.l grid_bytes(a6),d0 ;amount in use
- add.l d0,d0 ;by grid & undo
- add.l d0,d1 ;total to be free
-
-
- * Now calculate how much we'll need to allocate for the new grid
- * array and undo array.
-
-
- move.w tmp_across(a6),d0 ;no of squares across
- mulu tmp_down(a6),d0 ;no of squares down
- add.l d0,d0 ;array of m x n WORDS
- move.l d0,tmp_size(a6) ;save size
- add.l d0,d0 ;2 of them!
-
-
- * Now see if there is enough memory.
-
-
- cmp.l d1,d0 ;enough memory?
- bls.s RPG_Ok ;skip if so
-
-
- * Here, there isn't so report the problem and then leave.
-
-
- lea IRT_1(pc),a1
- lea NoNewGrid(pc),a0
- moveq #8,d0
- move.l a1,irt_itext(a6)
- move.l a0,irt_tlist(a6)
- move.w d0,irt_count(a6)
- bsr LinkInfoText
- bsr ShowInfoReq
-
- moveq #0,d0 ;signal all's NOT well
-
- bra RPG_1 ;and leave
-
-
- * Here, we're all right. Get rid of old grid, old undo array,
- * then allocate new ones. Do it all within Forbid()/Permit()
- * to make sure another task doesn't steal my memory!
-
-
- RPG_Ok CALLEXEC Forbid
-
- move.l grid_array(a6),d0 ;got current grid?
- beq.s RPG_b3 ;skip if not
- move.l d0,a1
- move.l grid_bytes(a6),d0
- CALLEXEC FreeMem ;release old grid
-
- RPG_b3 move.l undo_array(a6),d0 ;got undo array?
- beq.s RPG_b4 ;skip if not
- move.l d0,a1
- move.l grid_bytes(a6),d0
- CALLEXEC FreeMem ;release old Undo
-
- RPG_b4 move.l tmp_size(a6),d0 ;first get new grid
- move.l #MEMF_VARS,d1
- CALLEXEC AllocMem
- move.l d0,grid_array(a6)
-
- move.l tmp_size(a6),d0 ;now get new undo
- move.l #MEMF_VARS,d1
- CALLEXEC AllocMem
- move.l d0,undo_array(a6)
-
- move.w tmp_across(a6),grid_across(a6)
- move.w tmp_down(a6),grid_down(a6)
- move.l tmp_size(a6),grid_bytes(a6)
-
- CALLEXEC Permit
-
-
- * Now set the coordinate limits for the mouse pointer. If mouse is in these
- * limits, it's on the grid, otherwise it's off...
-
-
- move.w #GRID_LEFT,d0 ;minimum LHS mouse coord
- move.w d0,grid_hl(a6) ;save it
- move.w #SQ_X,d1
- move.w grid_across(a6),d2
- cmp.w #MAX_DISPX,d2
- bls.s RPG_b1
- move.w #MAX_DISPX,d2 ;constrain for oversize grid
-
- RPG_b1 mulu d2,d1
- add.w d1,d0
- subq.w #1,d0
- move.w d0,grid_hu(a6) ;maximum RHS mouse coord
-
- move.w #GRID_UP,d0 ;minimum top mouse coord
- move.w d0,grid_vl(a6) ;save it
- move.w #SQ_Y,d1
- move.w grid_down(a6),d2
- cmp.w #MAX_DISPY,d2
- bls.s RPG_b2
- move.w #MAX_DISPY,d2 ;constrain for oversize grid
-
- RPG_b2 mulu d2,d1
- add.w d1,d0
- subq.w #1,d0
- move.w d0,grid_vu(a6) ;maximum bottom mouse coord
-
-
- * Now start changing the screen image for the new grid...
-
-
- move.l mw_rastport(a6),a1 ;tmp change
- moveq #0,d0 ;plotting pen
- CALLGRAF SetAPen
-
- move.l mw_rastport(a6),a1 ;erase image
- move.w #GRID_LEFT,d0 ;from screen
- move.w #GRID_UP,d1
- move.w #GRID_LEFT+MAX_DISP_PX,d2
- move.w #GRID_UP+MAX_DISP_PY,d3
- CALLGRAF RectFill
-
- move.l mw_rastport(a6),a1 ;recover original
- moveq #4,d0 ;detail pen
- CALLGRAF SetAPen
-
- move.l grid_rp(a6),a1
- moveq #1,d0
- CALLGRAF SetRast ;get rid of old grid image
-
- bsr SetMainHVPots ;set PropGadgets & TLC
-
- lea NC_Type(pc),a0 ;get ptr to Type Gadget
-
- move.w gg_Flags(a0),d0 ;get flags
-
- and.w #SELECTED,d0 ;was it in the selected state?
- bne.s RPG_2 ;yes it was, so Type 2 grid
-
- bclr #6,applic_flag1(a6) ;set Type 1 grid
- bsr FillBlack2 ;as it says
-
- move.l mw_handle(a6),a0
- CALLINT ClearMenuStrip
-
- move.l mw_handle(a6),a0 ;turn on the "Fill
- move.w #1+0*32+0*2048+$F800,d0 ;Black" menu item
- CALLINT OnMenu
-
- move.l mw_handle(a6),a0
- move.l menu_strip(a6),a1
- CALLINT SetMenuStrip
-
- bra.s RPG_1 ;and go display it
-
- RPG_2 bset #6,applic_flag1(a6) ;set Type 2 grid
- bsr FillWhite2 ;as it says
-
- move.l mw_handle(a6),a0
- CALLINT ClearMenuStrip
-
- move.l mw_handle(a6),a0 ;turn off the "Fill
- move.w #1+0*32+0*2048+$F800,d0 ;Black" menu item
- CALLINT OffMenu
-
- move.l mw_handle(a6),a0
- move.l menu_strip(a6),a1
- CALLINT SetMenuStrip
-
- moveq #-1,d0 ;signal all IS well...
-
- RPG_1 rts ;and done.
-
-
- * QuitCode(a6)
- * a6 = ptr to main program variables
- * signals end of application runtime
-
- * NON-MODIFIABLE
-
-
- QuitCode lea QRT_1(pc),a0 ;set up the text data
- lea Quit_YN(pc),a1 ;for the query
- moveq #3,d0 ;requester
-
- move.l a0,irt_itext(a6) ;put said data here
- move.l a1,irt_tlist(a6)
- move.w d0,irt_count(a6)
-
- bsr DoQueryReq ;does the lot in one go
-
- btst #6,applic_flag2(a6) ;pressed "YES" gadget?
- beq.s QuitCode_1 ;skip if not
-
- bclr #7,applic_flag1(a6) ;else quit program
-
- QuitCode_1 rts
-
-
- * WaitForReq(a6)
- * a6 = ptr to main program variables
- * Exit wait loop of HandleRequest() when REQSET arrives!
-
- * nothing corrupt
-
-
- WaitForReq bclr #7,applic_flag2(a6) ;exit req loop
- rts
-
-
- * QuitReq(a6)
- * a6 = ptr to main program variables
- * signals end of current requester, with the
- * CANCEL gadget pressed.
-
- * NON-MODIFIABLE
-
-
- QuitReq bclr #7,applic_flag2(a6)
- bclr #6,applic_flag2(a6)
- rts
-
-
- * LeaveReq(a6)
- * a6 = ptr to main program variables
- * signals end of current requester,
- * with the SELECT/EXECUTE gadget pressed.
-
-
- LeaveReq bclr #7,applic_flag2(a6)
- bset #6,applic_flag2(a6)
- rts
-
-
-
- * Here go IDCMP comparator lists for event handling.
- * Each entry consists of:1 longword IDCMP spec, then
- * 1 longword, address of routine to execute when this
- * IDCMP message is received. Last longword 0 marks the
- * end of the list.
-
-
- IDCMPlist1 dc.l GADGETDOWN,DoIGadget
- dc.l GADGETUP,DoRGadget
- dc.l MENUPICK,DoMenus
- dc.l MOUSEMOVE,DoMouseMove
- dc.l MOUSEBUTTONS,DoMouseButton
- dc.l DISKINSERTED,InDrive
- dc.l DISKREMOVED,OutDrive
- dc.l RAWKEY,HandleKey
- dc.l 0
-
-
- IDCMPlist2 dc.l GADGETDOWN,DoIGadget
- dc.l GADGETUP,DoRGadget
- dc.l REQSET,WaitForReq
- dc.l 0
-
- IDCMPlist3 dc.l MOUSEMOVE,DG_Done
- dc.l MOUSEBUTTONS,ExitInfo
- dc.l REQSET,WaitForReq
- dc.l 0
-
- IDCMPlist4 dc.l GADGETDOWN,DoIGadget
- dc.l GADGETUP,DoRGadget
- dc.l DISKINSERTED,InDrive
- dc.l DISKREMOVED,OutDrive
- dc.l 0
-
-
-
- * Menu List for main window. Entry consists of:
- * 1 word for MenuNumber for comparison,
- * 1 longword for routine to execute,
- * until MENUNULL at end of list.
-
-
- menulist_1 dc.w 0+0*32+0*2048+$F800
- dc.l DoDiscPanel
- dc.w 0+1*32+0*2048+$F800
- dc.l MakeNewGrid
- dc.w 0+2*32+0*2048+$F800
- dc.l QuitCode
-
- dc.w 1+0*32+0*2048+$F800
- dc.l FillBlack2
- dc.w 1+1*32+0*2048+$F800
- dc.l FillWhite2
- dc.w 1+2*32+0*2048+$F800
- dc.l ClearGrid
-
- dc.w 2+0*32+0*2048+$F800
- dc.l CreateClueList
- dc.w 2+1*32+0*2048+$F800
- dc.l EditClue
- dc.w 2+2*32+0*2048+$F800
- dc.l EraseClue
-
- dc.w 3+0*32+0*2048+$F800
- dc.l Solve
- dc.w 3+1*32+0*2048+$F800
- dc.l Rubout ;SodOff
-
- dc.w MENUNULL
-
-
- * Gadget list for ID number dependent gadgets on main window.
- * Consists of longword pointers to routines to execute.
-
-
- gadgetlist1 dc.l DG_Done
-
-
- * Standard Event Handler Block for the main window.
-
-
- ehb_std dc.l AlterEvent ;do VERIFYs?
- dc.l SelectEvent ;normal OtherCode
- dc.l IDCMPlist1 ;normal IDCMP list
-
-
- * Event handler block for Requesters including QueryRequesters
-
-
- ehb_req dc.l AlterEvent ;normal MouseCode
- dc.l SelectEvent ;normal OtherCode
- dc.l IDCMPlist2 ;requester IDCMP list
-
-
- * Event handler block for InfoRequesters
-
-
- ehb_info dc.l AlterEvent
- dc.l SelectEvent
- dc.l IDCMPlist3
-
-
- * Event handler block for disc access panel.
-
-
- ehb_dp dc.l AlterEvent ;do VERIFYs?
- dc.l SelectEvent ;normal OtherCode
- dc.l IDCMPlist4 ;normal IDCMP list
-
-
- * Requester handling block. Usage:set rhb_Window, rhb_UserPort with
- * values for given window. Set rhb_IDCMP with the normal IDCMP for
- * the window, to be restored when all requesters are inactive.
- * Put ptr to Requester structure in rhb_Requester.
- * Then pass pointer to this block in a4 to HandleRequest().
-
-
- ReqBlock dc.l 0,0,0,0,0,0
-
-
- * Topaz-80 font TextAttr structure
-
-
- Topaz_80 dc.l Topaz_80_name
- dc.w 8 ;height = 8 (TOPAZ_80)
- dc.b 0 ;no style flags
- dc.b $01 ;ROM font
- even
-
-
- * Clue List Header Block (not initialised)
-
-
- CLHeader ds.b clh_sizeof
-
-
- * Texts such as library names etc.
-
-
- dos_name dc.b "dos.library",0
-
- int_name dc.b "intuition.library",0
-
- graf_name dc.b "graphics.library",0
-
- Topaz_80_name dc.b "topaz.font",0
-
- even
-
-
- * Various code files.
-
-
- include SOURCE2:INCLUDES/CWReqHandler.i
-
- include SOURCE2:INCLUDES/CWDiscHandler.i
-
- include SOURCE2:INCLUDES/CWDiscButtons.i
-
- include SOURCE2:INCLUDES/CWExtras.i
-
- include SOURCE2:INCLUDES/CWClues.i
-
- include SOURCE2:INCLUDES/CWInfoReq.i
-
- include SOURCE2:INCLUDES/CWQueryReq.i
-
-
-
- * Data structures include files
-
-
- include SOURCE2:INCLUDES/CWMenus.i
-
- include SOURCE2:INCLUDES/CWNewReq.i
-
- include SOURCE2:INCLUDES/CWDiscReq.i
-
- include SOURCE2:INCLUDES/CWSolutions.i
-
- include SOURCE2:INCLUDES/CWHelpCode.i
-
- include SOURCE2:INCLUDES/CWInfoTexts.i
-
- include SOURCE2:INCLUDES/CWFormat.i
-
-
- * Graphics images include files and CHIP memory graphics data
-
-
- section graphics,DATA_C
-
-
- * Custom pointer for CrossWord program, 16 x 15,
- * displayed as main pointer throughout the program.
-
-
- CWPointer dc.w $8050,$9000 ;control words (see ASPG)
-
- dc.w $0008,$0036 ;sprite def (15 lines)
- dc.w $0010,$006e
- dc.w $0022,$00dc
- dc.w $0044,$01ba
- dc.w $0088,$0376
-
- dc.w $0110,$06ec
- dc.w $0220,$0dd8
- dc.w $0440,$1bb0
- dc.w $0880,$3760
- dc.w $0100,$7ec0
-
- dc.w $7200,$7d80
- dc.w $f800,$ff00
- dc.w $f800,$fe00
- dc.w $3800,$fc00
- dc.w $3000,$f000
-
- dc.w $0000,$0000 ;last 2 words
-
-
- * This sprite pointer is 16 x 49. It is the "Zzzz" pointer for
- * this program, equivalent to DPaint's "Zz" or PowerWindows'
- * "HANG" pointer, displaed when user should wait for something.
-
-
- CWHangPtr dc.w 0,0
-
- dc.w $0000,$0000
- dc.w $3800,$0088
- dc.w $2400,$0088
- dc.w $2400,$0088
- dc.w $2400,$0088
- dc.w $3800,$0088
- dc.w $2000,$00A8
- dc.w $2000,$00D8
- dc.w $2000,$0088
- dc.w $0000,$0000
-
- dc.w $0020,$2000
- dc.w $0050,$2000
- dc.w $0088,$2000
- dc.w $0088,$2000
- dc.w $00F8,$2000
- dc.w $0088,$2000
- dc.w $0088,$3C00
- dc.w $0000,$0000
- dc.w $3C70,$3C70
- dc.w $2020,$2020
-
- dc.w $2020,$2020
- dc.w $3820,$3820
- dc.w $2020,$2020
- dc.w $2020,$2020
- dc.w $3C70,$3C70
- dc.w $0000,$0000
- dc.w $0800,$00F8
- dc.w $1400,$0020
- dc.w $2200,$0020
- dc.w $2200,$0020
-
- dc.w $3E00,$0020
- dc.w $2200,$0020
- dc.w $2200,$0020
- dc.w $0000,$0000
- dc.w $1C20,$1C20
- dc.w $2220,$2220
- dc.w $2020,$2020
- dc.w $1C20,$1C20
- dc.w $0220,$0220
- dc.w $2200,$2200
-
- dc.w $1C20,$1C20
- dc.w $0000,$0000
- dc.w $3C00,$0000
- dc.w $2000,$0000
- dc.w $2000,$0000
- dc.w $3800,$0000
- dc.w $2000,$0000
- dc.w $2000,$0000
- dc.w $3C00,$0000
-
- dc.w $0000,$0000
-
-
- * Data for squares as passed to BltBitMapRastPort().
-
-
- bsquare dc.w %0000000000000000
- dc.w %0000000000000000
- dc.w %0000000000000000
- dc.w %0000000000000000
- dc.w %0000000000000000
- dc.w %0000000000000000
- dc.w %0000000000000000
- dc.w %0000000000000000
- dc.w %0000000000000000
- dc.w %0000000000000000
-
-
- wsquare dc.w %0000000000000000
- dc.w %0111111110000000
- dc.w %0111111110000000
- dc.w %0111111110000000
- dc.w %0111111110000000
- dc.w %0111111110000000
- dc.w %0111111110000000
- dc.w %0111111110000000
- dc.w %0111111110000000
- dc.w %0000000000000000
-
-
- vbsquare dc.w %0000000000000000
- dc.w %0111111100000000
- dc.w %0111111100000000
- dc.w %0111111100000000
- dc.w %0111111100000000
- dc.w %0111111100000000
- dc.w %0111111100000000
- dc.w %0111111100000000
- dc.w %0111111100000000
- dc.w %0000000000000000
-
-
- hbsquare dc.w %0000000000000000
- dc.w %0111111110000000
- dc.w %0111111110000000
- dc.w %0111111110000000
- dc.w %0111111110000000
- dc.w %0111111110000000
- dc.w %0111111110000000
- dc.w %0111111110000000
- dc.w %0000000000000000
- dc.w %0000000000000000
-
-
- bbsquare dc.w %0000000000000000
- dc.w %0111111100000000
- dc.w %0111111100000000
- dc.w %0111111100000000
- dc.w %0111111100000000
- dc.w %0111111100000000
- dc.w %0111111100000000
- dc.w %0111111100000000
- dc.w %0000000000000000
- dc.w %0000000000000000
-
-
- include SOURCE2:INCLUDES/CWImage1.i
- include SOURCE2:INCLUDES/CWImage2.i
- include SOURCE2:INCLUDES/CWImage3.i
-
-
-
-
-
-